Fixed paged tracks directive

This commit is contained in:
Josef Citrine 2016-08-29 00:09:01 +01:00
parent bce22d6877
commit ff7b6fca3f
5 changed files with 9 additions and 16 deletions

View file

@ -9,10 +9,10 @@
"packages": {}, "packages": {},
"dependencies": {}, "dependencies": {},
"devDependencies": { "devDependencies": {
"angular": "1.5.6", "angular": "1.5.8",
"angular-chart.js": "1.0.0-alpha6", "angular-chart.js": "1.0.0-alpha6",
"angular-strap": "2.3.8", "angular-strap": "2.3.8",
"angular-ui-router": "0.2.18", "angular-ui-router": "0.3.1",
"chart.js": "2.1.0", "chart.js": "2.1.0",
"coffee-loader": "0.7.2", "coffee-loader": "0.7.2",
"coffee-script": "1.10.0", "coffee-script": "1.10.0",
@ -31,8 +31,7 @@
"gulp-plumber": "1.1.0", "gulp-plumber": "1.1.0",
"gulp-sourcemaps": "1.6.0", "gulp-sourcemaps": "1.6.0",
"gulp-util": "3.0.7", "gulp-util": "3.0.7",
"jquery": "2.2.0", "jquery": "2.2.4",
"jquery-ui": "1.10.5",
"script-loader": "0.7.0", "script-loader": "0.7.0",
"underscore": "1.8.3", "underscore": "1.8.3",
"webpack": "1.13.1", "webpack": "1.13.1",

View file

@ -279,12 +279,12 @@ ponyfm.config [
templateUrl: '/templates/admin/show-songs.html' templateUrl: '/templates/admin/show-songs.html'
state.state 'admin.tracks', state.state 'admin.tracks',
url: '/tracks' url: '/tracks?filter&page'
controller: 'admin-tracks' controller: 'admin-tracks'
templateUrl: '/templates/admin/tracks.html' templateUrl: '/templates/admin/tracks.html'
state.state 'admin.classifier', state.state 'admin.classifier',
url: '/tracks/unclassified' url: '/tracks/unclassified?filter&page'
controller: 'admin-classifier' controller: 'admin-classifier'
templateUrl: '/templates/admin/classifier.html' templateUrl: '/templates/admin/classifier.html'

View file

@ -21,6 +21,7 @@ window.pfm.preloaders['admin-classifier'] = [
tracks.mainQuery.fromFilterString($state.params.filter) tracks.mainQuery.fromFilterString($state.params.filter)
tracks.mainQuery.setPage $state.params.page || 1 tracks.mainQuery.setPage $state.params.page || 1
tracks.mainQuery.setAdmin true tracks.mainQuery.setAdmin true
tracks.mainQuery.fetch(tracks.FetchType.UNCLASSIFIED)
) )
] ]
@ -28,5 +29,4 @@ module.exports = angular.module('ponyfm').controller "admin-classifier", [
'$scope', 'tracks', '$state', '$scope', 'tracks', '$state',
($scope, tracks, $state) -> ($scope, tracks, $state) ->
] ]

View file

@ -21,12 +21,11 @@ window.pfm.preloaders['admin-tracks'] = [
tracks.mainQuery.fromFilterString($state.params.filter) tracks.mainQuery.fromFilterString($state.params.filter)
tracks.mainQuery.setPage $state.params.page || 1 tracks.mainQuery.setPage $state.params.page || 1
tracks.mainQuery.setAdmin true tracks.mainQuery.setAdmin true
tracks.mainQuery.fetch(tracks.FetchType.ALL)
) )
] ]
module.exports = angular.module('ponyfm').controller "admin-tracks", [ module.exports = angular.module('ponyfm').controller "admin-tracks", [
'$scope', 'tracks', '$state', '$scope', 'tracks', '$state',
($scope, tracks, $state) -> ($scope, tracks, $state) ->
] ]

View file

@ -58,16 +58,11 @@ module.exports = angular.module('ponyfm').directive 'pfmPagedTracksList', () ->
# The actual last page will always be in the paginator. # The actual last page will always be in the paginator.
$scope.pages.push($scope.totalPages) unless $scope.totalPages in $scope.pages $scope.pages.push($scope.totalPages) unless $scope.totalPages in $scope.pages
console.log $state
$scope.pageSelectorShown = false $scope.pageSelectorShown = false
$scope.gotoPage = (page) -> $scope.gotoPage = (page) ->
#$state.transitionTo $state.current.name, {filter: $state.params.filter, page: page} #$scope.$emit 'pageChange', {filter: $state.params.filter, page: page}
#$location.search 'filter', $state.params.filter $state.go '.', {filter: $state.params.filter, page: page}
#$location.search 'page', page
tracks.mainQuery.fromFilterString($state.params.filter)
tracks.mainQuery.setPage page || 1
$scope.showPageSelector = () -> $scope.showPageSelector = () ->
$scope.pageSelectorShown = true $scope.pageSelectorShown = true