Go to top on a page change

This commit is contained in:
FinnStutzenstein 2017-10-13 09:03:18 +02:00
parent 3c9ae628e8
commit 96cd3405aa
10 changed files with 71 additions and 23 deletions

View File

@ -164,6 +164,7 @@ angular.module('OpenSlidesApp.agenda.site', [
$scope.limitBegin = 0; $scope.limitBegin = 0;
$scope.pageChanged = function() { $scope.pageChanged = function() {
$scope.limitBegin = ($scope.currentPage - 1) * $scope.itemsPerPage; $scope.limitBegin = ($scope.currentPage - 1) * $scope.itemsPerPage;
$scope.gotoTop();
}; };
// parse duration for inline editing // parse duration for inline editing

View File

@ -128,7 +128,8 @@
</div> </div>
</div> </div>
<div class="spacer-top-lg italic"> <div class="spacer-top-lg italic row">
<div class="col-md-6">
<span os-perms="agenda.can_see_hidden_items">{{ itemsFiltered.length }} /</span> <span os-perms="agenda.can_see_hidden_items">{{ itemsFiltered.length }} /</span>
{{ items.length }} {{ "items" | translate }}<span ng-if="(items|filter:{selected:true}).length > 0">, {{ items.length }} {{ "items" | translate }}<span ng-if="(items|filter:{selected:true}).length > 0">,
{{(items|filter:{selected:true}).length}} {{ "selected" | translate }}</span> {{(items|filter:{selected:true}).length}} {{ "selected" | translate }}</span>
@ -140,6 +141,13 @@
(<translate>Estimated end:</translate> {{ calculateEndTime() }}) (<translate>Estimated end:</translate> {{ calculateEndTime() }})
</span> </span>
</span> </span>
</span>
</div>
<div class="col-md-6" ng-show="itemsFiltered.length > itemsPerPage">
<span class="pull-right">
<translate>Page</translate> {{ currentPage }} / {{ Math.ceil(itemsFiltered.length/itemsPerPage) }}
</span>
</div>
</div> </div>
<div id="agenda-table" class="os-table container-fluid"> <div id="agenda-table" class="os-table container-fluid">

View File

@ -351,6 +351,7 @@ angular.module('OpenSlidesApp.assignments.site', [
$scope.limitBegin = 0; $scope.limitBegin = 0;
$scope.pageChanged = function() { $scope.pageChanged = function() {
$scope.limitBegin = ($scope.currentPage - 1) * $scope.itemsPerPage; $scope.limitBegin = ($scope.currentPage - 1) * $scope.itemsPerPage;
$scope.gotoTop();
}; };
// update phase // update phase

View File

@ -71,11 +71,18 @@
</div> </div>
</div> </div>
<div class="spacer-top-lg italic"> <div class="spacer-top-lg italic row">
<div class="col-md-6">
{{ assignmentsFiltered.length }} / {{ assignmentsFiltered.length }} /
{{ assignments.length }} {{ "elections" | translate }}<span ng-if="(assignments|filter:{selected:true}).length > 0">, {{ assignments.length }} {{ "elections" | translate }}<span ng-if="(assignments|filter:{selected:true}).length > 0">,
{{(assignments|filter:{selected:true}).length}} {{ "selected" | translate }}</span> {{(assignments|filter:{selected:true}).length}} {{ "selected" | translate }}</span>
</div> </div>
<div class="col-md-6" ng-show="assignmentsFiltered.length > itemsPerPage">
<span class="pull-right">
<translate>Page</translate> {{ currentPage }} / {{ Math.ceil(assignmentsFiltered.length/itemsPerPage) }}
</span>
</div>
</div>
<div class="os-table container-fluid"> <div class="os-table container-fluid">
<div class="row header-row"> <div class="row header-row">

View File

@ -526,6 +526,14 @@ angular.module('OpenSlidesApp.core', [
} }
]) ])
// Put the Math object into every scope.
.run([
'$rootScope',
function ($rootScope) {
$rootScope.Math = window.Math;
}
])
// Template hooks // Template hooks
// 2 possible uses: // 2 possible uses:
// - { Id: 'myHookId', template: '<button>click me</button>' } // - { Id: 'myHookId', template: '<button>click me</button>' }

View File

@ -1008,7 +1008,14 @@ angular.module('OpenSlidesApp.core.site', [
$scope.show = ($window.pageYOffset >= 150); $scope.show = ($window.pageYOffset >= 150);
}); });
}); });
$scope.gotoTop = function () { }
])
.run([
'$rootScope',
'$window',
function ($rootScope, $window) {
$rootScope.gotoTop = function () {
$window.scrollTo(0, 0); $window.scrollTo(0, 0);
}; };
} }

View File

@ -1055,6 +1055,7 @@ angular.module('OpenSlidesApp.motions.site', [
$scope.limitBegin = 0; $scope.limitBegin = 0;
$scope.pageChanged = function() { $scope.pageChanged = function() {
$scope.limitBegin = ($scope.currentPage - 1) * $scope.itemsPerPage; $scope.limitBegin = ($scope.currentPage - 1) * $scope.itemsPerPage;
$scope.gotoTop();
}; };

View File

@ -119,11 +119,18 @@
</div> </div>
</div> </div>
<div class="spacer-top-lg italic"> <div class="spacer-top-lg italic row">
<div class="col-md-6">
{{ motionsFiltered.length }} / {{ motionsFiltered.length }} /
{{ motions.length }} {{ "motions" | translate }}<span ng-if="(motions|filter:{selected:true}).length > 0">, {{ motions.length }} {{ "motions" | translate }}<span ng-if="(motions|filter:{selected:true}).length > 0">,
{{(motions|filter:{selected:true}).length}} {{ "selected" | translate }}</span> {{(motions|filter:{selected:true}).length}} {{ "selected" | translate }}</span>
</div> </div>
<div class="col-md-6" ng-show="motionsFiltered.length > itemsPerPage">
<span class="pull-right">
<translate>Page</translate> {{ currentPage }} / {{ Math.ceil(motionsFiltered.length/itemsPerPage) }}
</span>
</div>
</div>
<div class="os-table container-fluid"> <div class="os-table container-fluid">
<div class="row header-row"> <div class="row header-row">

View File

@ -623,6 +623,7 @@ angular.module('OpenSlidesApp.users.site', [
$scope.limitBegin = 0; $scope.limitBegin = 0;
$scope.pageChanged = function() { $scope.pageChanged = function() {
$scope.limitBegin = ($scope.currentPage - 1) * $scope.itemsPerPage; $scope.limitBegin = ($scope.currentPage - 1) * $scope.itemsPerPage;
$scope.gotoTop();
}; };
// Toggle group from user // Toggle group from user

View File

@ -126,11 +126,18 @@
</div> </div>
</div> </div>
<div class="spacer-top-lg italic"> <div class="spacer-top-lg italic row">
<div class="col-md-6">
{{ usersFiltered.length }} / {{ usersFiltered.length }} /
{{ users.length }} {{ "participants" | translate }}<span ng-if="(users|filter:{selected:true}).length > 0">, {{ users.length }} {{ "participants" | translate }}<span ng-if="(users|filter:{selected:true}).length > 0">,
{{(users|filter:{selected:true}).length}} {{ "selected" | translate }}</span> {{(users|filter:{selected:true}).length}} {{ "selected" | translate }}</span>
</div> </div>
<div class="col-md-6" ng-show="usersFiltered.length > itemsPerPage">
<span class="pull-right">
<translate>Page</translate> {{ currentPage }} / {{ Math.ceil(usersFiltered.length/itemsPerPage) }}
</span>
</div>
</div>
<!-- filter users (for user with 'can_see_extra_data' permission) - consider present filter --> <!-- filter users (for user with 'can_see_extra_data' permission) - consider present filter -->
<div os-perms="users.can_see_extra_data"> <div os-perms="users.can_see_extra_data">