mirror of
https://github.com/sismics/docs.git
synced 2024-11-22 22:07:56 +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.asc = false;
|
||||||
$scope.offset = 0;
|
$scope.offset = 0;
|
||||||
$scope.currentPage = 1;
|
$scope.currentPage = 1;
|
||||||
$scope.limit = 10;
|
$scope.limit = _.isUndefined(localStorage.documentsPageSize) ? 10 : localStorage.documentsPageSize;
|
||||||
$scope.search = '';
|
$scope.search = '';
|
||||||
|
|
||||||
// A timeout promise is used to slow down search requests to the server
|
// 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.
|
* Watch for search scope change.
|
||||||
*/
|
*/
|
||||||
$scope.$watch('search', function(prev, next) {
|
$scope.$watch('search', function() {
|
||||||
if (timeoutPromise) {
|
if (timeoutPromise) {
|
||||||
// Cancel previous timeout
|
// Cancel previous timeout
|
||||||
$timeout.cancel(timeoutPromise);
|
$timeout.cancel(timeoutPromise);
|
||||||
@ -84,6 +84,17 @@ angular.module('docs').controller('Document', function($scope, $timeout, $state,
|
|||||||
$scope.loadDocuments();
|
$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.
|
* Go to add document form.
|
||||||
*/
|
*/
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* Document edition controller.
|
* 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
|
// Alerts
|
||||||
$scope.alerts = [];
|
$scope.alerts = [];
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ angular.module('docs').controller('DocumentEdit', function($rootScope, $scope, $
|
|||||||
var then = function() {
|
var then = function() {
|
||||||
key++;
|
key++;
|
||||||
if ($scope.newFiles[key]) {
|
if ($scope.newFiles[key]) {
|
||||||
sendFile(key).then(then);
|
sendFile(key).then(then); // TODO Handle upload error
|
||||||
} else {
|
} else {
|
||||||
$scope.fileIsUploading = false;
|
$scope.fileIsUploading = false;
|
||||||
$scope.fileProgress = 0;
|
$scope.fileProgress = 0;
|
||||||
|
@ -47,8 +47,14 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class="text-center">
|
<div class="text-center pagination-box">
|
||||||
<pagination total-items="totalDocuments" max-size="5" page="currentPage"></pagination>
|
<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>
|
||||||
|
|
||||||
<div class="text-right">
|
<div class="text-right">
|
||||||
|
@ -136,9 +136,21 @@ input[readonly].share-link {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pagination
|
// Pagination
|
||||||
.pagination {
|
.pagination > .active > a {
|
||||||
ul > li {
|
cursor: pointer !important;
|
||||||
cursor: pointer;
|
}
|
||||||
|
|
||||||
|
// Pagination box
|
||||||
|
.pagination-box {
|
||||||
|
pagination {
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
select {
|
||||||
|
vertical-align: top;
|
||||||
|
width: auto;
|
||||||
|
display: inline-block;
|
||||||
|
margin: 20px 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user