|
|
@@ -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) {
|