diff --git a/docs-web/src/main/webapp/src/app/docs/controller/Document.js b/docs-web/src/main/webapp/src/app/docs/controller/Document.js index 7a127547..4c15e862 100644 --- a/docs-web/src/main/webapp/src/app/docs/controller/Document.js +++ b/docs-web/src/main/webapp/src/app/docs/controller/Document.js @@ -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. diff --git a/docs-web/src/main/webapp/src/app/docs/controller/DocumentEdit.js b/docs-web/src/main/webapp/src/app/docs/controller/DocumentEdit.js index 42ac85e1..7aff1ac2 100644 --- a/docs-web/src/main/webapp/src/app/docs/controller/DocumentEdit.js +++ b/docs-web/src/main/webapp/src/app/docs/controller/DocumentEdit.js @@ -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; diff --git a/docs-web/src/main/webapp/src/partial/docs/document.html b/docs-web/src/main/webapp/src/partial/docs/document.html index 0bd3a628..66647a32 100644 --- a/docs-web/src/main/webapp/src/partial/docs/document.html +++ b/docs-web/src/main/webapp/src/partial/docs/document.html @@ -47,8 +47,14 @@ -