Browse Source

Merge branch 'master' of ssh://gogs.davidventura.com.ar:442/david/alexis2

Conflicts:
	front/js/app.js
Tati 10 năm trước cách đây
mục cha
commit
01c8e80e67
1 tập tin đã thay đổi với 8 bổ sung1 xóa
  1. 8 1
      front/js/app.js

+ 8 - 1
front/js/app.js

@@ -57,6 +57,7 @@ app.controller('main', function($scope,$http,$sce) {
 	$scope.selectedArticle = {};
 	$scope.curPage=1;
 	$scope.totPages=1;
+	$scope.pages=[]
 	var lastPage=0;
 	var itemsPerPage=15;
 
@@ -68,7 +69,6 @@ app.controller('main', function($scope,$http,$sce) {
 		return $scope.keywords.filter(function(e) { return e.toLowerCase().indexOf(q) > -1});
 	};
 	$scope.addKeyword = function(k) {
-
 		c=$scope.selected_kw.filter(function(el) { return el.text==k; }).length;
 		if (c>0)
 			return;
@@ -130,6 +130,12 @@ app.controller('main', function($scope,$http,$sce) {
 						});
 				//$scope.news=data.data.articles;
 				$scope.totPages=Math.ceil(data.data.count/itemsPerPage);
+				var arr = []
+				var maxPage=Math.min($scope.curPage+2,$scope.totPages);
+				var minPage=Math.max($scope.curPage-2,1);
+				for(var i=minPage; i<=maxPage;i++)
+					arr.push(i);
+				$scope.pages=arr;
 			},
 			function(data) {
 			}
@@ -159,6 +165,7 @@ app.controller('main', function($scope,$http,$sce) {
 	$scope.isCurrent = function(page){
 		return page === $scope.curPage;
 	}
+
 	$scope.delete_article = function(id) {
 		$http.get("/pymnts/article/delete/"+id).then(
 			function(data) {