From 08a665ef9f6fda7035e81473f68b3f485cdc530d Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Thu, 30 Oct 2014 19:19:55 +0500 Subject: [PATCH] [#369] projects page: fix paginate --- .../angular-new/controllers/projects_controller.js | 3 +-- app/views/projects/projects/index.html.haml | 7 ++----- app/views/projects/projects/index.json.jbuilder | 3 +-- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/angular-new/controllers/projects_controller.js b/app/assets/javascripts/angular-new/controllers/projects_controller.js index 8889af48f..bb8003fc2 100644 --- a/app/assets/javascripts/angular-new/controllers/projects_controller.js +++ b/app/assets/javascripts/angular-new/controllers/projects_controller.js @@ -15,9 +15,8 @@ RosaABF.controller('ProjectsCtrl', ['$scope', '$http', function($scope, $http) { var params = { format: 'json', page: $scope.page, search: $scope.search, users: $scope.filter_users, groups: $scope.filter_groups }; $http.get(Routes.projects_path(params)).then(function(res) { - $scope.page = res.data.page; - $scope.total_items = parseInt(res.data.projects_count, 10); $scope.projects = res.data.projects; + $scope.pages = res.data.pages; }); }; diff --git a/app/views/projects/projects/index.html.haml b/app/views/projects/projects/index.html.haml index 5d875d4ae..f7248fd8e 100644 --- a/app/views/projects/projects/index.html.haml +++ b/app/views/projects/projects/index.html.haml @@ -37,8 +37,5 @@ %span.fa.fa-lg.fa-times.text-danger{ 'confirmed-click' => 'leave_project(item)', 'ng-show' => 'item.can_leave_project', 'ng-confirm-click' => t('layout.confirm') } - = paginate( total_items: 'total_items', - page: 'page', - per_page: Project.per_page, - ng_show: "total_items > #{Project.per_page}", - select_page: "goToPage(page)" ) + = render 'shared/angularjs_will_paginate' + diff --git a/app/views/projects/projects/index.json.jbuilder b/app/views/projects/projects/index.json.jbuilder index 27e451353..a51846654 100644 --- a/app/views/projects/projects/index.json.jbuilder +++ b/app/views/projects/projects/index.json.jbuilder @@ -13,5 +13,4 @@ json.projects do end end -json.page params[:page] -json.projects_count @projects_count +json.pages angularjs_will_paginate(@projects)