mirror of
https://github.com/sismics/docs.git
synced 2024-12-22 19:33:47 +01:00
Page size selector
This commit is contained in:
parent
6edae27d26
commit
5cf0532db7
@ -11,7 +11,7 @@ angular.module('docs').controller('Document', function($scope, $timeout, $state,
|
||||
$scope.asc = false;
|
||||
$scope.offset = 0;
|
||||
$scope.currentPage = 1;
|
||||
$scope.limit = 10;
|
||||
$scope.limit = _.isUndefined(localStorage.documentsPageSize) ? 10 : localStorage.documentsPageSize;
|
||||
$scope.search = '';
|
||||
|
||||
// A timeout promise is used to slow down search requests to the server
|
||||
@ -59,7 +59,7 @@ angular.module('docs').controller('Document', function($scope, $timeout, $state,
|
||||
/**
|
||||
* Watch for search scope change.
|
||||
*/
|
||||
$scope.$watch('search', function(prev, next) {
|
||||
$scope.$watch('search', function() {
|
||||
if (timeoutPromise) {
|
||||
// Cancel previous timeout
|
||||
$timeout.cancel(timeoutPromise);
|
||||
@ -83,6 +83,17 @@ angular.module('docs').controller('Document', function($scope, $timeout, $state,
|
||||
$scope.sortColumn = sortColumn;
|
||||
$scope.loadDocuments();
|
||||
};
|
||||
|
||||
/**
|
||||
* Watch for page size change.
|
||||
*/
|
||||
$scope.$watch('limit', function(next, prev) {
|
||||
localStorage.documentsPageSize = next;
|
||||
if (next == prev) {
|
||||
return;
|
||||
}
|
||||
$scope.loadDocuments();
|
||||
});
|
||||
|
||||
/**
|
||||
* Go to add document form.
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* Document edition controller.
|
||||
*/
|
||||
angular.module('docs').controller('DocumentEdit', function($rootScope, $scope, $q, $http, $state, $stateParams, Restangular, Tag) {
|
||||
angular.module('docs').controller('DocumentEdit', function($rootScope, $scope, $q, $http, $state, $stateParams, Restangular) {
|
||||
// Alerts
|
||||
$scope.alerts = [];
|
||||
|
||||
@ -156,7 +156,7 @@ angular.module('docs').controller('DocumentEdit', function($rootScope, $scope, $
|
||||
var then = function() {
|
||||
key++;
|
||||
if ($scope.newFiles[key]) {
|
||||
sendFile(key).then(then);
|
||||
sendFile(key).then(then); // TODO Handle upload error
|
||||
} else {
|
||||
$scope.fileIsUploading = false;
|
||||
$scope.fileProgress = 0;
|
||||
|
@ -47,8 +47,14 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="text-center">
|
||||
<div class="text-center pagination-box">
|
||||
<pagination total-items="totalDocuments" max-size="5" page="currentPage"></pagination>
|
||||
<label class="sr-only" for="pagesizeSelect">Page size</label>
|
||||
<select ng-model="limit" id="pagesizeSelect" class="form-control">
|
||||
<option value="10">10 per page</option>
|
||||
<option value="20">20 per page</option>
|
||||
<option value="30">30 per page</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="text-right">
|
||||
|
@ -136,10 +136,22 @@ input[readonly].share-link {
|
||||
}
|
||||
|
||||
// Pagination
|
||||
.pagination {
|
||||
ul > li {
|
||||
cursor: pointer;
|
||||
}
|
||||
.pagination > .active > a {
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
// Pagination box
|
||||
.pagination-box {
|
||||
pagination {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
select {
|
||||
vertical-align: top;
|
||||
width: auto;
|
||||
display: inline-block;
|
||||
margin: 20px 0;
|
||||
}
|
||||
}
|
||||
|
||||
.nav-text-error {
|
||||
|
Loading…
Reference in New Issue
Block a user