US/121 remove example projects
parent
7802f3d0f5
commit
08d9e17894
|
@ -40,38 +40,7 @@ class ProjectsNavigationController extends taiga.Controller
|
||||||
|
|
||||||
loadInitialData: ->
|
loadInitialData: ->
|
||||||
return @rs.projects.list().then (projects) =>
|
return @rs.projects.list().then (projects) =>
|
||||||
example = [
|
@scope.projects = projects
|
||||||
{'id': 200, 'name': 'sdfdsfs', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 201, 'name': 'sdfdsfs1', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 2001, 'name': 'sdfdsfs2', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 2002, 'name': 'sdfdsfs3', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 2003, 'name': 'sdfdsfs4', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 2004, 'name': 'sdfdsfs5', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 2005, 'name': 'sdfdsfs6', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 2006, 'name': 'sdfdsfs7', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 2007, 'name': 'sdfdsfs8', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 2008, 'name': 'sdfdsfs9', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 2009, 'name': 'sdfdsfs10', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20010, 'name': 'sdfdsfs11', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20011, 'name': 'sdfdsfs12', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20012, 'name': 'sdfdsfs13', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20013, 'name': 'sdfdsfs14', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20014, 'name': 'sdfdsfs15', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20015, 'name': 'sdfdsfs16', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20016, 'name': 'sdfdsfs17', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20017, 'name': 'sdfdsfs18', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20018, 'name': 'sdfdsfs19', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20019, 'name': 'sdfdsfs20', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20020, 'name': 'sdfdsfs21', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20021, 'name': 'sdfdsfs22', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20022, 'name': 'sdfdsfs23', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20023, 'name': 'sdfdsfs24', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20024, 'name': 'sdfdsfs25', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20025, 'name': 'sdfdsfs26', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20026, 'name': 'sdfdsfs27', 'slug': 'sdfsdf'}
|
|
||||||
]
|
|
||||||
|
|
||||||
@scope.projects = projects.concat(example)
|
|
||||||
return projects
|
return projects
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,38 +11,6 @@ class ProjectController extends taiga.Controller
|
||||||
|
|
||||||
loadInitialData: ->
|
loadInitialData: ->
|
||||||
return @rs.projects.list().then (projects) =>
|
return @rs.projects.list().then (projects) =>
|
||||||
example = [
|
|
||||||
{'id': 200, 'name': 'sdfdsfs', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 201, 'name': 'sdfdsfs1', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 2001, 'name': 'sdfdsfs2', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 2002, 'name': 'sdfdsfs3', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 2003, 'name': 'sdfdsfs4', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 2004, 'name': 'sdfdsfs5', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 2005, 'name': 'sdfdsfs6', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 2006, 'name': 'sdfdsfs7', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 2007, 'name': 'sdfdsfs8', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 2008, 'name': 'sdfdsfs9', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 2009, 'name': 'sdfdsfs10', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20010, 'name': 'sdfdsfs11', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20011, 'name': 'sdfdsfs12', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20012, 'name': 'sdfdsfs13', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20013, 'name': 'sdfdsfs14', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20014, 'name': 'sdfdsfs15', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20015, 'name': 'sdfdsfs16', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20016, 'name': 'sdfdsfs17', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20017, 'name': 'sdfdsfs18', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20018, 'name': 'sdfdsfs19', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20019, 'name': 'sdfdsfs20', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20020, 'name': 'sdfdsfs21', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20021, 'name': 'sdfdsfs22', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20022, 'name': 'sdfdsfs23', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20023, 'name': 'sdfdsfs24', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20024, 'name': 'sdfdsfs25', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20025, 'name': 'sdfdsfs26', 'slug': 'sdfsdf'},
|
|
||||||
{'id': 20026, 'name': 'sdfdsfs27', 'slug': 'sdfsdf'}
|
|
||||||
]
|
|
||||||
|
|
||||||
projects = projects.concat(example)
|
|
||||||
@.projects = {'recents': projects.slice(0, 8), 'all': projects.slice(6)}
|
@.projects = {'recents': projects.slice(0, 8), 'all': projects.slice(6)}
|
||||||
|
|
||||||
module.controller("ProjectController", ProjectController)
|
module.controller("ProjectController", ProjectController)
|
||||||
|
@ -77,22 +45,21 @@ ProjectsPaginationDirective = ($timeout) ->
|
||||||
|
|
||||||
pageSize = 0
|
pageSize = 0
|
||||||
containerSize = 0
|
containerSize = 0
|
||||||
animationInProgess = false
|
|
||||||
|
|
||||||
animationEnd = () ->
|
remove = () ->
|
||||||
animationInProgess = false
|
container.css('top', 0)
|
||||||
|
hide(prevBtn)
|
||||||
|
hide(nextBtn)
|
||||||
|
|
||||||
prevBtn.on "click", (event) ->
|
prevBtn.on "click", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
|
||||||
if animationInProgess
|
if container.is(':animated')
|
||||||
return
|
return
|
||||||
|
|
||||||
animationInProgess = true
|
|
||||||
|
|
||||||
visible(nextBtn)
|
visible(nextBtn)
|
||||||
|
|
||||||
newTop = prevPage(container, pageSize, animationEnd)
|
newTop = prevPage(container, pageSize)
|
||||||
|
|
||||||
if newTop == 0
|
if newTop == 0
|
||||||
hide(prevBtn)
|
hide(prevBtn)
|
||||||
|
@ -100,19 +67,18 @@ ProjectsPaginationDirective = ($timeout) ->
|
||||||
nextBtn.on "click", (event) ->
|
nextBtn.on "click", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
|
||||||
if animationInProgess
|
if container.is(':animated')
|
||||||
return
|
return
|
||||||
|
|
||||||
animationInProgess = true
|
|
||||||
|
|
||||||
visible(prevBtn)
|
visible(prevBtn)
|
||||||
|
|
||||||
newTop = nextPage(container, pageSize, animationEnd)
|
newTop = nextPage(container, pageSize)
|
||||||
|
|
||||||
if -newTop + pageSize > containerSize
|
if -newTop + pageSize > containerSize
|
||||||
hide(nextBtn)
|
hide(nextBtn)
|
||||||
|
|
||||||
$scope.$watch 'active', (ee) ->
|
$scope.$watch 'active', () ->
|
||||||
|
#wait digest end
|
||||||
$timeout () ->
|
$timeout () ->
|
||||||
if $scope.active
|
if $scope.active
|
||||||
pageSize = $el.find(".v-pagination-list").height()
|
pageSize = $el.find(".v-pagination-list").height()
|
||||||
|
@ -121,20 +87,21 @@ ProjectsPaginationDirective = ($timeout) ->
|
||||||
if containerSize > pageSize
|
if containerSize > pageSize
|
||||||
visible(nextBtn)
|
visible(nextBtn)
|
||||||
else
|
else
|
||||||
container.css('top', 0)
|
remove()
|
||||||
hide(prevBtn)
|
|
||||||
hide(nextBtn)
|
|
||||||
else
|
else
|
||||||
container.css('top', 0)
|
remove()
|
||||||
hide(prevBtn)
|
|
||||||
hide(nextBtn)
|
|
||||||
return {
|
return {
|
||||||
scope: {
|
scope: {
|
||||||
active: '='
|
active: '='
|
||||||
},
|
},
|
||||||
link: link,
|
link: link,
|
||||||
transclude: true,
|
transclude: true,
|
||||||
templateUrl: 'partials/views/components/pagination.html'
|
template: """
|
||||||
|
<a class="v-pagination-previous icon icon-arrow-up " href=""></a>
|
||||||
|
<div class="v-pagination-list" ng-transclude=""></div>
|
||||||
|
<a class="v-pagination-next icon icon-arrow-bottom" href=""></a>
|
||||||
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
module.directive("tgProjectsPagination", ['$timeout', ProjectsPaginationDirective])
|
module.directive("tgProjectsPagination", ['$timeout', ProjectsPaginationDirective])
|
||||||
|
|
Loading…
Reference in New Issue