mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 11:00:03 -03:30
Merge pull request #84 from mabashian/7274-pagination
Fixed first/last pagination controls
This commit is contained in:
commit
378e8630e2
@ -7,6 +7,7 @@ export default ['$scope', '$stateParams', '$state', '$filter', 'GetBasePath', 'Q
|
||||
$scope.pageSize = pageSize;
|
||||
|
||||
$scope.basePageSize = parseInt(pageSize) === 5 ? 5 : 20;
|
||||
$scope.maxVisiblePages = $scope.maxVisiblePages ? parseInt($scope.maxVisiblePages) : 10;
|
||||
|
||||
function init() {
|
||||
|
||||
@ -94,7 +95,7 @@ export default ['$scope', '$stateParams', '$state', '$filter', 'GetBasePath', 'Q
|
||||
|
||||
function calcPageRange(current, last) {
|
||||
let result = [],
|
||||
maxVisiblePages = $scope.maxVisiblePages ? parseInt($scope.maxVisiblePages) : 10,
|
||||
maxVisiblePages = parseInt($scope.maxVisiblePages),
|
||||
pagesLeft,
|
||||
pagesRight;
|
||||
if(maxVisiblePages % 2) {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<div class="Paginate-wrapper" ng-hide="dataset.count <= pageSize">
|
||||
<ul class="Paginate-controls pagination">
|
||||
<!-- first -->
|
||||
<li class="Paginate-controls--first Paginate-controls--item" ng-hide="pageRange.length < 10 || {{current}} === 1">
|
||||
<li class="Paginate-controls--first Paginate-controls--item" ng-hide="pageRange.length < maxVisiblePages || current === 1">
|
||||
<a href ng-click="toPage(1)">
|
||||
<i class="fa fa-angle-double-left"></i>
|
||||
</a>
|
||||
@ -24,7 +24,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<!-- last -->
|
||||
<li class="Paginate-controls--item Paginate-controls--last" ng-hide="(pageRange.length < 10 || current === last)">
|
||||
<li class="Paginate-controls--item Paginate-controls--last" ng-hide="(pageRange.length < maxVisiblePages || current === last)">
|
||||
<a href id="last-page-set" ng-click="toPage(last)">
|
||||
<i class="fa fa-angle-double-right"></i>
|
||||
</a>
|
||||
|
||||
@ -12,6 +12,7 @@ export default {
|
||||
listTitle: 'INVENTORY SOURCES',
|
||||
index: false,
|
||||
hover: true,
|
||||
searchBarFullWidth: true,
|
||||
|
||||
fields: {
|
||||
name: {
|
||||
|
||||
@ -679,6 +679,7 @@ angular.module('templates', [surveyMaker.name, templatesList.name, jobTemplates.
|
||||
delete list.fields.last_updated;
|
||||
list.fields.name.columnClass = "col-md-11";
|
||||
list.maxVisiblePages = 5;
|
||||
list.searchBarFullWidth = true;
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@ export default ['i18n', function(i18n) {
|
||||
selectInstructions: i18n.sprintf(i18n._("Click on a row to select it, and click Finished when done. Use the %s button to create a new job template."), "<i class=\"icon-plus\"></i> "),
|
||||
index: false,
|
||||
hover: true,
|
||||
searchBarFullWidth: true,
|
||||
|
||||
fields: {
|
||||
name: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user