[#369] fix a build lists pagination; small refactoring

This commit is contained in:
Alexander Machehin 2014-10-30 22:06:14 +05:00
parent 530523611c
commit b55342e178
5 changed files with 9 additions and 13 deletions

View File

@ -134,7 +134,8 @@ RosaABF.controller('BuildListsController',
// Render pagination // Render pagination
$scope.page = results.page; $scope.page = results.page;
$scope.build_lists_count = results.build_lists_count; $scope.total_items = results.total_items;
// Enable 'Search' button // Enable 'Search' button
$scope.isRequest = false; $scope.isRequest = false;
}).error(function(data, status, headers, config) { }).error(function(data, status, headers, config) {

View File

@ -26,7 +26,6 @@ module PaginateHelper
{ {
total_items: 'total_items', total_items: 'total_items',
page: 'page', page: 'page',
ng_show: "total_items > #{options[:per_page]}",
select_page: "goToPage(page)" select_page: "goToPage(page)"
} }
) )

View File

@ -70,10 +70,6 @@
/ updated_at / updated_at
%td{'am-time-ago' => 'bl.updated_at', title: "{{bl.updated_at | amDateFormat:'ddd, LLL'}}"} %td{'am-time-ago' => 'bl.updated_at', title: "{{bl.updated_at | amDateFormat:'ddd, LLL'}}"}
= paginate( total_items: 'build_lists_count', = angularjs_paginate( per_page: 'params.per_page' )
page: 'page',
per_page: 'params.per_page',
ng_show: "build_lists_count > params.per_page",
select_page: "goToPage(page)" )
= render @project ? 'projects/base/submenu' : 'projects/build_lists/submenu' = render @project ? 'projects/base/submenu' : 'projects/build_lists/submenu'

View File

@ -41,4 +41,4 @@ end
json.server_status @build_server_status json.server_status @build_server_status
json.filter @filter.try(:options) json.filter @filter.try(:options)
json.page params[:page] json.page params[:page]
json.build_lists_count @bls.count json.total_items @bls.count

View File

@ -10,5 +10,5 @@ pagination[ boundary-links = 'true'
items-per-page = per_page items-per-page = per_page
max-size = 5 max-size = 5
rotate = 'false' rotate = 'false'
ng-show = ng_show ng-show = "#{total_items} > #{per_page}"
ng-change = select_page ] ng-change = select_page ]