|
@@ -56,6 +56,7 @@ app.controller('main', function($scope,$http,$sce) {
|
|
|
$scope.newsArticle="";
|
|
$scope.newsArticle="";
|
|
|
$scope.curPage=1;
|
|
$scope.curPage=1;
|
|
|
$scope.totPages=1;
|
|
$scope.totPages=1;
|
|
|
|
|
+ $scope.pages=[]
|
|
|
var lastPage=0;
|
|
var lastPage=0;
|
|
|
var itemsPerPage=15;
|
|
var itemsPerPage=15;
|
|
|
|
|
|
|
@@ -67,7 +68,6 @@ app.controller('main', function($scope,$http,$sce) {
|
|
|
return $scope.keywords.filter(function(e) { return e.toLowerCase().indexOf(q) > -1});
|
|
return $scope.keywords.filter(function(e) { return e.toLowerCase().indexOf(q) > -1});
|
|
|
};
|
|
};
|
|
|
$scope.addKeyword = function(k) {
|
|
$scope.addKeyword = function(k) {
|
|
|
-
|
|
|
|
|
c=$scope.selected_kw.filter(function(el) { return el.text==k; }).length;
|
|
c=$scope.selected_kw.filter(function(el) { return el.text==k; }).length;
|
|
|
if (c>0)
|
|
if (c>0)
|
|
|
return;
|
|
return;
|
|
@@ -128,6 +128,12 @@ app.controller('main', function($scope,$http,$sce) {
|
|
|
});
|
|
});
|
|
|
//$scope.news=data.data.articles;
|
|
//$scope.news=data.data.articles;
|
|
|
$scope.totPages=Math.ceil(data.data.count/itemsPerPage);
|
|
$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<=maxPages;i++)
|
|
|
|
|
+ arr.push(i);
|
|
|
|
|
+ $scope.pages=arr;
|
|
|
},
|
|
},
|
|
|
function(data) {
|
|
function(data) {
|
|
|
}
|
|
}
|
|
@@ -147,13 +153,6 @@ app.controller('main', function($scope,$http,$sce) {
|
|
|
$scope.filter(newPage);
|
|
$scope.filter(newPage);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- $scope.pages = function() {
|
|
|
|
|
- var arr = [];
|
|
|
|
|
- for(var i=$scope.curPage -2; i<=$scope.curPage+2;i++)
|
|
|
|
|
- if (i>=1 && i<=$scope.totPages)
|
|
|
|
|
- arr.push(i);
|
|
|
|
|
- return arr;
|
|
|
|
|
- };
|
|
|
|
|
$scope.delete_article = function(id) {
|
|
$scope.delete_article = function(id) {
|
|
|
$http.get("/pymnts/article/delete/"+id).then(
|
|
$http.get("/pymnts/article/delete/"+id).then(
|
|
|
function(data) {
|
|
function(data) {
|