OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Scroll mobile header with content
Inga Mai3017f8ff85b5
diff --git a/frontend/src/app/globals/global-listeners.ts b/frontend/src/app/globals/global-listeners.tsindex 5c2d059add2..6d9776dbcbb 100644--- a/frontend/src/app/globals/global-listeners.ts+++ b/frontend/src/app/globals/global-listeners.ts@@ -30,6 +30,7 @@ import {performAnchorHijacking} from "./global-listeners/link-hijacking";import {augmentedDatePicker} from "./global-listeners/augmented-date-picker";import {refreshOnFormChanges} from 'core-app/globals/global-listeners/refresh-on-form-changes';import {registerRequestForConfirmation} from "core-app/globals/global-listeners/request-for-confirmation";+import {scrollHeaderOnMobile} from "core-app/globals/global-listeners/top-menu-scroll";/*** A set of listeners that are relevant on every page to set sensible defaults@@ -94,6 +95,9 @@ import {registerRequestForConfirmation} from "core-app/globals/global-listeners/// Allow forms with [request-for-confirmation]// to show the password confirmation dialogregisterRequestForConfirmation($);++ // Register scroll handler on mobile header+ scrollHeaderOnMobile(jQuery('#content-wrapper'));});}(jQuery));diff --git a/frontend/src/app/globals/global-listeners/top-menu-scroll.ts b/frontend/src/app/globals/global-listeners/top-menu-scroll.tsnew file mode 100644index 00000000000..4edf7d3f16c--- /dev/null+++ b/frontend/src/app/globals/global-listeners/top-menu-scroll.ts@@ -0,0 +1,51 @@+// -- copyright+// OpenProject is a project management system.+// Copyright (C) 2012-2015 the OpenProject Foundation (OPF)+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License+// as published by the Free Software Foundation; either version 2+// of the License, or (at your option) any later version.+//+// This program is distributed in the hope that it will be useful,+// but WITHOUT ANY WARRANTY; without even the implied warranty of+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+// GNU General Public License for more details.+//+// You should have received a copy of the GNU General Public License+// along with this program; if not, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See doc/COPYRIGHT.rdoc for more details.+// +++++import {DeviceService} from "core-app/modules/common/browser/device.service";++export function scrollHeaderOnMobile(elem:JQuery) {+ const deviceService:DeviceService = new DeviceService();+ const headerHeight = '55px';+ let prevScrollPos = elem.scrollTop();++ elem.on('scroll', (event) => {+ // Only on mobile screen sizes+ if (!deviceService.isMobile) {+ return;+ }++ let currentScrollPos = elem.scrollTop();+ if ((prevScrollPos && currentScrollPos && prevScrollPos >= currentScrollPos) || currentScrollPos === 0) {+ jQuery('#top-menu').css({'margin-top':'0', transition:'margin-top .4s'});+ } else {+ jQuery('#top-menu').css({'margin-top':'-' + headerHeight, transition:'margin-top .4s'});+ }+ prevScrollPos = currentScrollPos;+ });+}diff --git a/frontend/src/app/modules/work_packages/routing/wp-list/wp-list.component.ts b/frontend/src/app/modules/work_packages/routing/wp-list/wp-list.component.tsindex 415e25071d3..2369af3193e 100644--- a/frontend/src/app/modules/work_packages/routing/wp-list/wp-list.component.ts+++ b/frontend/src/app/modules/work_packages/routing/wp-list/wp-list.component.ts@@ -39,6 +39,7 @@ import {wpDisplayCardRepresentation} from "core-app/modules/work_packages/routinimport {WorkPackageTableConfigurationObject} from "core-components/wp-table/wp-table-configuration";import {HalResourceNotificationService} from "core-app/modules/hal/services/hal-resource-notification.service";import {WorkPackageNotificationService} from "core-app/modules/work_packages/notifications/work-package-notification.service";+import {scrollHeaderOnMobile} from "core-app/globals/global-listeners/top-menu-scroll";@Component({selector: 'wp-list',@@ -130,6 +131,9 @@ export class WorkPackagesListComponent extends WorkPackagesViewBase implements O}this.cdRef.detectChanges();++ // Scroll header on mobile in and out when user scrolls the container+ scrollHeaderOnMobile(jQuery('.work-packages--card-view-container'));});}