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
Update the html title when the split screen has been closed. Otherwise the WP title will remain in the html title (#40033)
Henriette Dargea9f7e2610f45
diff --git a/frontend/src/app/core/html/op-title.service.ts b/frontend/src/app/core/html/op-title.service.tsindex e0887431f7c..11f79816b0d 100644--- a/frontend/src/app/core/html/op-title.service.ts+++ b/frontend/src/app/core/html/op-title.service.ts@@ -23,4 +23,11 @@ export class OpTitleService {this.titleService.setTitle(parts.join(titlePartsSeparator));}++ public prependFirstPart(value:string) {+ const parts = this.titleParts;+ parts.unshift(value);++ this.titleService.setTitle(parts.join(titlePartsSeparator));+ }}diff --git a/frontend/src/app/features/boards/board/board-partitioned-page/board-partitioned-page.component.ts b/frontend/src/app/features/boards/board/board-partitioned-page/board-partitioned-page.component.tsindex 09789280322..62b01aa5fdd 100644--- a/frontend/src/app/features/boards/board/board-partitioned-page/board-partitioned-page.component.ts+++ b/frontend/src/app/features/boards/board/board-partitioned-page/board-partitioned-page.component.ts@@ -1,5 +1,9 @@import {- ChangeDetectionStrategy, ChangeDetectorRef, Component, Injector,+ ChangeDetectionStrategy,+ ChangeDetectorRef,+ Component,+ Injector,+ OnDestroy,} from '@angular/core';import {DynamicComponentDefinition,@@ -26,6 +30,7 @@ import { Ng2StateDeclaration } from '@uirouter/angular';import { BoardFiltersService } from 'core-app/features/boards/board/board-filter/board-filters.service';import { CardViewHandlerRegistry } from 'core-app/features/work-packages/components/wp-card-view/event-handler/card-view-handler-registry';import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';+import { OpTitleService } from 'core-app/core/html/op-title.service';export function boardCardViewHandlerFactory(injector:Injector) {return new CardViewHandlerRegistry(injector);@@ -86,6 +91,7 @@ export class BoardPartitionedPageComponent extends UntilDestroyedMixin {showToolbarSaveButton:boolean;/** Listener callbacks */+ // eslint-disable-next-line @typescript-eslint/ban-typesremoveTransitionSubscription:Function;/** Show a toolbar */@@ -146,7 +152,9 @@ export class BoardPartitionedPageComponent extends UntilDestroyedMixin {readonly injector:Injector,readonly apiV3Service:ApiV3Service,readonly boardFilters:BoardFiltersService,- readonly Boards:BoardService) {+ readonly Boards:BoardService,+ readonly titleService:OpTitleService,+ ) {super();}@@ -169,6 +177,14 @@ export class BoardPartitionedPageComponent extends UntilDestroyedMixin {this.showToolbarSaveButton = !!params.query_props;this.setPartition(toState);++ this+ .board$+ .pipe(take(1))+ .subscribe((board) => {+ this.titleService.setFirstPart(board.name);+ });+this.cdRef.detectChanges();});@@ -180,7 +196,9 @@ export class BoardPartitionedPageComponent extends UntilDestroyedMixin {const queryProps = this.state.params.query_props;this.editable = board.editable;this.selectedTitle = board.name;+ this.titleService.setFirstPart(board.name);this.boardFilters.filters.putValue(queryProps ? JSON.parse(queryProps) : board.filters);+this.cdRef.detectChanges();});}diff --git a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center-page.component.ts b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center-page.component.tsindex 015ec1aeebd..eb6b704896b 100644--- a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center-page.component.ts+++ b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center-page.component.ts@@ -3,6 +3,7 @@ import {ChangeDetectorRef,Component,Injector,+ OnDestroy,OnInit,} from '@angular/core';import {@@ -21,6 +22,7 @@ import { MarkAllAsReadButtonComponent } from 'core-app/features/in-app-notificatimport { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';import { BackRoutingService } from 'core-app/features/work-packages/components/back-routing/back-routing.service';import { IanCenterService } from 'core-app/features/in-app-notifications/center/state/ian-center.service';+import { OpTitleService } from 'core-app/core/html/op-title.service';@Component({templateUrl: '../../work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.html',@@ -32,7 +34,7 @@ import { IanCenterService } from 'core-app/features/in-app-notifications/center/],changeDetection: ChangeDetectionStrategy.OnPush,})-export class InAppNotificationCenterPageComponent extends UntilDestroyedMixin implements OnInit {+export class InAppNotificationCenterPageComponent extends UntilDestroyedMixin implements OnInit, OnDestroy {text = {title: this.I18n.t('js.notifications.title'),};@@ -55,6 +57,10 @@ export class InAppNotificationCenterPageComponent extends UntilDestroyedMixin im/** Toolbar is not editable */titleEditingEnabled = false;+ /** Listener callbacks */+ // eslint-disable-next-line @typescript-eslint/ban-types+ removeTransitionSubscription:Function;+/** Not savable */showToolbarSaveButton = false;@@ -87,12 +93,23 @@ export class InAppNotificationCenterPageComponent extends UntilDestroyedMixin imreadonly injector:Injector,readonly apiV3Service:ApiV3Service,readonly backRoutingService:BackRoutingService,+ readonly titleService:OpTitleService,) {super();}ngOnInit():void {this.documentReferer = document.referrer;+ this.titleService.prependFirstPart(this.text.title);++ this.removeTransitionSubscription = this.$transitions.onSuccess({}, ():any => {+ this.titleService.setFirstPart(this.text.title);+ });+ }++ ngOnDestroy():void {+ super.ngOnDestroy();+ this.removeTransitionSubscription();}/**diff --git a/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts b/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.tsindex ca0e54e3f1c..7663aeb9271 100644--- a/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts+++ b/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts@@ -126,7 +126,7 @@ export class PartitionedQuerySpacePageComponent extends WorkPackagesViewBase impcomponent: WorkPackageFilterContainerComponent,};- ngOnInit() {+ ngOnInit():void {super.ngOnInit();this.showToolbarSaveButton = !!this.$state.params.query_props;@@ -136,6 +136,13 @@ export class PartitionedQuerySpacePageComponent extends WorkPackagesViewBase impconst toState = transition.to();this.showToolbarSaveButton = !!params.query_props;this.setPartition(toState);++ const query = this.querySpace.query.value;+ if (query && this.shouldUpdateHtmlTitle()) {+ // Update the title if we're in the list state alone+ this.titleService.setFirstPart(this.queryTitle(query));+ }+this.cdRef.detectChanges();});@@ -192,7 +199,7 @@ export class PartitionedQuerySpacePageComponent extends WorkPackagesViewBase impthis.queryParamListener.removeQueryChangeListener();}- public changeChangesFromTitle(val:string) {+ public changeChangesFromTitle(val:string):void {if (this.currentQuery && isPersistedResource(this.currentQuery)) {this.updateTitleName(val);} else {@@ -202,7 +209,7 @@ export class PartitionedQuerySpacePageComponent extends WorkPackagesViewBase imp}}- updateTitleName(val:string) {+ updateTitleName(val:string):void {this.toolbarDisabled = true;this.currentQuery!.name = val;this.wpListService@@ -210,17 +217,13 @@ export class PartitionedQuerySpacePageComponent extends WorkPackagesViewBase imp.finally(() => { this.toolbarDisabled = false; });}- updateTitle(query?:QueryResource) {+ updateTitle(query?:QueryResource):void {// Too early for loaded queryif (!query) {return;}- if (isPersistedResource(query)) {- this.selectedTitle = query.name;- } else {- this.selectedTitle = this.staticQueryName(query);- }+ this.selectedTitle = this.queryTitle(query);this.titleEditingEnabled = this.authorisationService.can('query', 'updateImmediately');@@ -253,7 +256,7 @@ export class PartitionedQuerySpacePageComponent extends WorkPackagesViewBase impprotected inviteModal = InviteUserModalComponent;- openInviteUserModal() {+ openInviteUserModal():void {const inviteModal = this.opModalService.show(this.inviteModal, 'global');inviteModal.closingEvent.subscribe((modal:any) => {console.log('Modal closed!', modal);@@ -303,4 +306,8 @@ export class PartitionedQuerySpacePageComponent extends WorkPackagesViewBase impconst isFirstLoad = !this.querySpace.initialized.hasValue();this.loadingIndicator = this.loadQuery(isFirstLoad);}++ private queryTitle(query:QueryResource):string {+ return isPersistedResource(query) ? query.name : this.staticQueryName(query);+ }}