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,18 +128,26 @@
</div> </div>
</div> </div>
<div class="spacer-top-lg italic"> <div class="spacer-top-lg italic row">
<span os-perms="agenda.can_see_hidden_items">{{ itemsFiltered.length }} /</span> <div class="col-md-6">
{{ items.length }} {{ "items" | translate }}<span ng-if="(items|filter:{selected:true}).length > 0">, <span os-perms="agenda.can_see_hidden_items">{{ itemsFiltered.length }} /</span>
{{(items|filter:{selected:true}).length}} {{ "selected" | translate }}</span> {{ items.length }} {{ "items" | translate }}<span ng-if="(items|filter:{selected:true}).length > 0">,
<span os-perms="agenda.can_see_hidden_items" class="optional"> {{(items|filter:{selected:true}).length}} {{ "selected" | translate }}</span>
<span ng-if="sumDurations() > 0">&middot; <span os-perms="agenda.can_see_hidden_items" class="optional">
<translate>Duration</translate>: <span ng-if="sumDurations() > 0">&middot;
{{ sumDurations() | osMinutesToTime }}h <translate>Duration</translate>:
<span ng-if="config('agenda_start_event_date_time')"> {{ sumDurations() | osMinutesToTime }}h
(<translate>Estimated end:</translate> {{ calculateEndTime() }}) <span ng-if="config('agenda_start_event_date_time')">
(<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,10 +71,17 @@
</div> </div>
</div> </div>
<div class="spacer-top-lg italic"> <div class="spacer-top-lg italic row">
{{ assignmentsFiltered.length }} / <div class="col-md-6">
{{ assignments.length }} {{ "elections" | translate }}<span ng-if="(assignments|filter:{selected:true}).length > 0">, {{ assignmentsFiltered.length }} /
{{(assignments|filter:{selected:true}).length}} {{ "selected" | translate }}</span> {{ 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>
<div class="os-table container-fluid"> <div class="os-table container-fluid">

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,10 +119,17 @@
</div> </div>
</div> </div>
<div class="spacer-top-lg italic"> <div class="spacer-top-lg italic row">
{{ motionsFiltered.length }} / <div class="col-md-6">
{{ motions.length }} {{ "motions" | translate }}<span ng-if="(motions|filter:{selected:true}).length > 0">, {{ motionsFiltered.length }} /
{{(motions|filter:{selected:true}).length}} {{ "selected" | translate }}</span> {{ 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>
<div class="os-table container-fluid"> <div class="os-table container-fluid">

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