Merge pull request #3444 from FinnStutzenstein/ScrollTopOnPageChange

Go to top on a page change
This commit is contained in:
Norman Jäckel 2017-10-22 15:35:12 +02:00 committed by GitHub
commit 73407133bd
10 changed files with 71 additions and 23 deletions

View File

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

View File

@ -128,7 +128,8 @@
</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>
{{ items.length }} {{ "items" | translate }}<span ng-if="(items|filter:{selected:true}).length > 0">,
{{(items|filter:{selected:true}).length}} {{ "selected" | translate }}</span>
@ -140,6 +141,13 @@
(<translate>Estimated end:</translate> {{ calculateEndTime() }})
</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 id="agenda-table" class="os-table container-fluid">

View File

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

View File

@ -71,11 +71,18 @@
</div>
</div>
<div class="spacer-top-lg italic">
<div class="spacer-top-lg italic row">
<div class="col-md-6">
{{ assignmentsFiltered.length }} /
{{ assignments.length }} {{ "elections" | translate }}<span ng-if="(assignments|filter:{selected:true}).length > 0">,
{{(assignments|filter:{selected:true}).length}} {{ "selected" | translate }}</span>
</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="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
// 2 possible uses:
// - { Id: 'myHookId', template: '<button>click me</button>' }

View File

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

View File

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

View File

@ -120,11 +120,18 @@
</div>
</div>
<div class="spacer-top-lg italic">
<div class="spacer-top-lg italic row">
<div class="col-md-6">
{{ motionsFiltered.length }} /
{{ motions.length }} {{ "motions" | translate }}<span ng-if="(motions|filter:{selected:true}).length > 0">,
{{(motions|filter:{selected:true}).length}} {{ "selected" | translate }}</span>
</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="row header-row">

View File

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

View File

@ -126,11 +126,18 @@
</div>
</div>
<div class="spacer-top-lg italic">
<div class="spacer-top-lg italic row">
<div class="col-md-6">
{{ usersFiltered.length }} /
{{ users.length }} {{ "participants" | translate }}<span ng-if="(users|filter:{selected:true}).length > 0">,
{{(users|filter:{selected:true}).length}} {{ "selected" | translate }}</span>
</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 -->
<div os-perms="users.can_see_extra_data">