Fixed pagination.

This commit is contained in:
Peter Deltchev 2016-02-16 05:04:00 -08:00
parent 608e31def9
commit 32a3b07f55
5 changed files with 21 additions and 9 deletions

View file

@ -32,10 +32,14 @@ class Assets
}
foreach ($scripts as $filename) {
if (Config::get('app.debug') && $filename !== 'templates.js') {
$scriptTags .= "<script src='http://localhost:61999/build/scripts/{$filename}'></script>";
} else {
$scriptTags .= "<script src='/build/scripts/{$filename}?" . filemtime(public_path("build/scripts/{$filename}")) . "'></script>";
}
}
if (Config::get("app.debug")) {
if (Config::get('app.debug')) {
$scriptTags .= '<script src="http://localhost:61999/webpack-dev-server.js"></script>';
}

View file

@ -69,13 +69,14 @@
<ul>
<li ng-class="{disabled: !prevPage}"><a href="#" ng-click="gotoPage(prevPage);" pfm-eat-click>Prev</a></li>
<li ng-repeat="page in pages track by page" ng-class="{active: page == currentPage}">
<a href="#" ng-click="gotoPage(page);" pfm-eat-click>{{::page}}</a>
<a href="#" ng-click="gotoPage(page);" pfm-eat-click>{{page}}</a>
</li>
<li ng-class="{disabled: !nextPage}"><a href="#" ng-click="gotoPage(nextPage);" pfm-eat-click>Next</a></li>
<li class="pagination-jump">
<a href="#" ng-click="showPageSelector();" ng-hide="pageSelectorShown" pfm-eat-click>Jump&hellip;</a>
<form ng-submit="jumpToPage()" ng-show="pageSelectorShown">
<input type="number" id="pagination-jump-destination" ng-model="inputPageNumber" ng-blur="hidePageSelector()">
<form ng-submit="jumpToPage(inputPageNumber)" ng-show="pageSelectorShown">
<input type="number" id="pagination-jump-destination" ng-model="inputPageNumber" ng-blur="hidePageSelector()" />
<input type="submit" />
</form>
</li>
</ul>

View file

@ -71,9 +71,9 @@ module.exports = angular.module('ponyfm').controller "tracks", [
$scope.pages.push($scope.totalPages) unless $scope.totalPages in $scope.pages
$scope.pageSelectorShown = false
$scope.inputPageNumber = $scope.currentPage
$scope.gotoPage = (page) ->
console.log(page)
$state.transitionTo 'content.tracks.list', {filter: $state.params.filter, page: page}
$scope.showPageSelector = () ->
@ -84,8 +84,8 @@ module.exports = angular.module('ponyfm').controller "tracks", [
$scope.pageSelectorShown = false
$scope.jumpToPage = () ->
$scope.gotoPage($scope.inputPageNumber)
$scope.jumpToPage = (inputPageNumber) ->
$scope.gotoPage(inputPageNumber)
$scope.$on '$destroy', -> tracks.mainQuery = tracks.createQuery()
]

View file

@ -421,5 +421,12 @@ html {
padding: 0 5px;
text-align: center;
}
// This submit button is hidden because the
// ng-submit directive it's part of doesn't work
// without a submit button present in the form.
input[type="submit"] {
display: none;
}
}
}

View file

@ -5,7 +5,7 @@ var _ = require('underscore');
var webpackBaseConfig = require('./webpack.base.config.js');
var config = _.clone(webpackBaseConfig);
config.devtool = 'source-map';
config.devtool = 'eval-source-map';
config.output.publicPath = 'http://localhost:61999/build/';