From bce22d6877db16939c7d1a1ca67e49c42457b4d4 Mon Sep 17 00:00:00 2001 From: Josef Citrine Date: Sun, 28 Aug 2016 04:14:48 +0100 Subject: [PATCH] Attempting (and failing) to fix pagination --- .../scripts/app/directives/paged-tracks-list.coffee | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/resources/assets/scripts/app/directives/paged-tracks-list.coffee b/resources/assets/scripts/app/directives/paged-tracks-list.coffee index 66958271..51ab0074 100644 --- a/resources/assets/scripts/app/directives/paged-tracks-list.coffee +++ b/resources/assets/scripts/app/directives/paged-tracks-list.coffee @@ -23,8 +23,8 @@ module.exports = angular.module('ponyfm').directive 'pfmPagedTracksList', () -> class: '@class' controller: [ - '$scope', 'tracks', '$state', - ($scope, tracks, $state) -> + '$scope', 'tracks', '$state', '$location' + ($scope, tracks, $state, $location) -> typeEnum = switch when $scope.type == 'normal' then tracks.FetchType.NORMAL when $scope.type == 'all' then tracks.FetchType.ALL @@ -58,10 +58,16 @@ module.exports = angular.module('ponyfm').directive 'pfmPagedTracksList', () -> # The actual last page will always be in the paginator. $scope.pages.push($scope.totalPages) unless $scope.totalPages in $scope.pages + console.log $state + $scope.pageSelectorShown = false $scope.gotoPage = (page) -> - $state.transitionTo $state.current.name, {filter: $state.params.filter, page: page} + #$state.transitionTo $state.current.name, {filter: $state.params.filter, page: page} + #$location.search 'filter', $state.params.filter + #$location.search 'page', page + tracks.mainQuery.fromFilterString($state.params.filter) + tracks.mainQuery.setPage page || 1 $scope.showPageSelector = () -> $scope.pageSelectorShown = true