Merge pull request #3698 from FinnStutzenstein/topPagination

Proposal for top pagenavigation
This commit is contained in:
Emanuel Schütze 2018-04-13 10:06:01 +02:00 committed by GitHub
commit 71b3cc181f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 82 additions and 6 deletions

View File

@ -129,6 +129,7 @@ Core:
easier development [#3566]. easier development [#3566].
- Reset scroll level for each new projection [#3686]. - Reset scroll level for each new projection [#3686].
- Scroll to top on every state change [#3689]. - Scroll to top on every state change [#3689].
- Added pagination on top of lists [#3698].
Mediafiles: Mediafiles:
- New form for uploading multiple files [#3650]. - New form for uploading multiple files [#3650].

View File

@ -173,7 +173,7 @@ angular.module('OpenSlidesApp.agenda.site', [
}; };
// pagination // pagination
$scope.pagination = osTablePagination.createInstance('AgendaTablePagination'); $scope.pagination = osTablePagination.createInstance('AgendaTablePagination', 50);
// parse duration for inline editing // parse duration for inline editing
$scope.generateDurationText = function (item) { $scope.generateDurationText = function (item) {

View File

@ -170,8 +170,16 @@
</div> </div>
<div class="col-md-6" ng-show="itemsFiltered.length > pagination.itemsPerPage"> <div class="col-md-6" ng-show="itemsFiltered.length > pagination.itemsPerPage">
<span class="pull-right"> <span class="pull-right">
<a href="" class="pagination-arrow" ng-click="pagination.prevPage()"
ng-if="pagination.showPrevPageArrow()">
&laquo;
</a>
<translate>Page</translate> {{ pagination.currentPage }} / <translate>Page</translate> {{ pagination.currentPage }} /
{{ Math.ceil(itemsFiltered.length/pagination.itemsPerPage) }} {{ pagination.getPageCount(itemsFiltered) }}
<a href="" class="pagination-arrow" ng-click="pagination.nextPage(itemsFiltered)"
ng-if="pagination.showNextPageArrow(itemsFiltered)">
&raquo;
</a>
</span> </span>
</div> </div>
</div> </div>

View File

@ -67,8 +67,16 @@
</div> </div>
<div class="col-md-6" ng-show="assignmentsFiltered.length > pagination.itemsPerPage"> <div class="col-md-6" ng-show="assignmentsFiltered.length > pagination.itemsPerPage">
<span class="pull-right"> <span class="pull-right">
<a href="" class="pagination-arrow" ng-click="pagination.prevPage()"
ng-if="pagination.showPrevPageArrow()">
&laquo;
</a>
<translate>Page</translate> {{ pagination.currentPage }} / <translate>Page</translate> {{ pagination.currentPage }} /
{{ Math.ceil(assignmentsFiltered.length/pagination.itemsPerPage) }} {{ pagination.getPageCount(assignmentsFiltered) }}
<a href="" class="pagination-arrow" ng-click="pagination.nextPage(assignmentsFiltered)"
ng-if="pagination.showNextPageArrow(assignmentsFiltered)">
&raquo;
</a>
</span> </span>
</div> </div>
</div> </div>

View File

@ -209,6 +209,16 @@ tr.selected td {
margin-left: 2px; margin-left: 2px;
} }
.pagination-arrow {
font-size: 150%;
padding: 3px;
text-decoration: none;
&:hover, &:focus {
text-decoration: none;
}
}
.grey { .grey {
color: #9a9898; color: #9a9898;
} }

View File

@ -650,6 +650,31 @@ angular.module('OpenSlidesApp.core.site', [
self.save(); self.save();
$rootScope.gotoTop(); $rootScope.gotoTop();
}; };
self.getPageCount = function (objs) {
if (objs) {
return Math.ceil(objs.length/self.itemsPerPage);
}
};
self.showNextPageArrow = function (objs) {
if (objs) {
return self.currentPage != self.getPageCount(objs);
}
};
self.showPrevPageArrow = function () {
return self.currentPage != 1;
};
self.nextPage = function (objs) {
if (objs && self.currentPage < self.getPageCount(objs)) {
self.currentPage++;
self.pageChanged();
}
};
self.prevPage = function () {
if (self.currentPage > 1) {
self.currentPage--;
self.pageChanged();
}
};
return self; return self;
}; };

View File

@ -146,8 +146,16 @@
</div> </div>
<div class="col-md-6" ng-show="mediafilesFiltered.length > pagination.itemsPerPage"> <div class="col-md-6" ng-show="mediafilesFiltered.length > pagination.itemsPerPage">
<span class="pull-right"> <span class="pull-right">
<a href="" class="pagination-arrow" ng-click="pagination.prevPage()"
ng-if="pagination.showPrevPageArrow()">
&laquo;
</a>
<translate>Page</translate> {{ pagination.currentPage }} / <translate>Page</translate> {{ pagination.currentPage }} /
{{ Math.ceil(mediafilesFiltered.length/pagination.itemsPerPage) }} {{ pagination.getPageCount(mediafilesFiltered) }}
<a href="" class="pagination-arrow" ng-click="pagination.nextPage(mediafilesFiltered)"
ng-if="pagination.showNextPageArrow(mediafilesFiltered)">
&raquo;
</a>
</span> </span>
</div> </div>
</div> </div>

View File

@ -128,8 +128,16 @@
</div> </div>
<div class="col-md-6" ng-show="motionsFiltered.length > pagination.itemsPerPage"> <div class="col-md-6" ng-show="motionsFiltered.length > pagination.itemsPerPage">
<span class="pull-right"> <span class="pull-right">
<a href="" class="pagination-arrow" ng-click="pagination.prevPage()"
ng-if="pagination.showPrevPageArrow()">
&laquo;
</a>
<translate>Page</translate> {{ pagination.currentPage }} / <translate>Page</translate> {{ pagination.currentPage }} /
{{ Math.ceil(motionsFiltered.length/pagination.itemsPerPage) }} {{ pagination.getPageCount(motionsFiltered) }}
<a href="" class="pagination-arrow" ng-click="pagination.nextPage(motionsFiltered)"
ng-if="pagination.showNextPageArrow(motionsFiltered)">
&raquo;
</a>
</span> </span>
</div> </div>
</div> </div>

View File

@ -149,8 +149,16 @@
</div> </div>
<div class="col-md-6" ng-show="usersFiltered.length > pagination.itemsPerPage"> <div class="col-md-6" ng-show="usersFiltered.length > pagination.itemsPerPage">
<span class="pull-right"> <span class="pull-right">
<a href="" class="pagination-arrow" ng-click="pagination.prevPage()"
ng-if="pagination.showPrevPageArrow()">
&laquo;
</a>
<translate>Page</translate> {{ pagination.currentPage }} / <translate>Page</translate> {{ pagination.currentPage }} /
{{ Math.ceil(usersFiltered.length/pagination.itemsPerPage) }} {{ pagination.getPageCount(usersFiltered) }}
<a href="" class="pagination-arrow" ng-click="pagination.nextPage(usersFiltered)"
ng-if="pagination.showNextPageArrow(usersFiltered)">
&raquo;
</a>
</span> </span>
</div> </div>
</div> </div>