diff --git a/client/src/app/core/ui-services/routing-state.service.ts b/client/src/app/core/ui-services/routing-state.service.ts index 320209b2f..4b4727218 100644 --- a/client/src/app/core/ui-services/routing-state.service.ts +++ b/client/src/app/core/ui-services/routing-state.service.ts @@ -15,20 +15,28 @@ export class RoutingStateService { /** * Hold the previous URL */ - private previousUrl: string; + private _previousUrl: string; /** * Unsafe paths that the user should not go "back" to * TODO: Might also work using Routing parameters */ - private unsafeUrls: string[] = ['/login', '/privacypolicy', '/legalnotice']; + private unsafeUrls: string[] = ['/login', '/privacypolicy', '/legalnotice', '/new', '/create']; /** * Checks if the previous URL is safe to navigate to. * If this fails, the open nav button should be shown */ public get isSafePrevUrl(): boolean { - return !this.previousUrl || !this.unsafeUrls.includes(this.previousUrl); + if (this._previousUrl) { + return !this.unsafeUrls.some(unsafeUrl => this._previousUrl.includes(unsafeUrl)); + } else { + return false; + } + } + + public get previousUrl(): string { + return this._previousUrl; } /** @@ -43,7 +51,7 @@ export class RoutingStateService { pairwise() ) .subscribe((event: any[]) => { - this.previousUrl = event[0].urlAfterRedirects; + this._previousUrl = event[0].urlAfterRedirects; }); } diff --git a/client/src/app/shared/components/head-bar/head-bar.component.html b/client/src/app/shared/components/head-bar/head-bar.component.html index fb0ca493c..ddc0a2947 100644 --- a/client/src/app/shared/components/head-bar/head-bar.component.html +++ b/client/src/app/shared/components/head-bar/head-bar.component.html @@ -11,7 +11,7 @@ - @@ -44,7 +44,7 @@ @@ -61,5 +61,10 @@ (click)="sendMainEvent()" matTooltip="{{ mainActionTooltip | translate }}" > - {{ mainButtonIcon }} + + add + + + {{ mainButtonIcon }} + diff --git a/client/src/app/shared/components/head-bar/head-bar.component.ts b/client/src/app/shared/components/head-bar/head-bar.component.ts index 54fdd4d2d..e3f62cfa1 100644 --- a/client/src/app/shared/components/head-bar/head-bar.component.ts +++ b/client/src/app/shared/components/head-bar/head-bar.component.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, Input, Output } from '@angular/core'; +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { MainMenuService } from 'app/core/core-services/main-menu.service'; @@ -17,11 +17,14 @@ import { ViewportService } from 'app/core/ui-services/viewport.service'; * ```html * @@ -52,7 +55,7 @@ import { ViewportService } from 'app/core/ui-services/viewport.service'; templateUrl: './head-bar.component.html', styleUrls: ['./head-bar.component.scss'] }) -export class HeadBarComponent { +export class HeadBarComponent implements OnInit { /** * Determine if the the navigation "hamburger" icon should be displayed in mobile mode */ @@ -65,6 +68,12 @@ export class HeadBarComponent { @Input() public mainButtonIcon = 'add_circle'; + /** + * Custom text to show as "save" + */ + @Input() + public saveText = 'Save'; + /** * Determine edit mode */ @@ -123,6 +132,11 @@ export class HeadBarComponent { @Output() public cancelEditEvent = new EventEmitter(); + /** + * To detect if the cancel event was used + */ + public isCancelEditUsed = false; + /** * Sends a signal if a detail view should be saved */ @@ -144,6 +158,13 @@ export class HeadBarComponent { private routingState: RoutingStateService ) {} + /** + * Detect if the cancel edit event was used + */ + public ngOnInit(): void { + this.isCancelEditUsed = this.cancelEditEvent.observers.length > 0; + } + /** * Emits a signal to the parent if */ diff --git a/client/src/app/site/motions/modules/motion-detail/components/amendment-create-wizard/amendment-create-wizard.component.html b/client/src/app/site/motions/modules/motion-detail/components/amendment-create-wizard/amendment-create-wizard.component.html index 398c5052b..6c820f220 100644 --- a/client/src/app/site/motions/modules/motion-detail/components/amendment-create-wizard/amendment-create-wizard.component.html +++ b/client/src/app/site/motions/modules/motion-detail/components/amendment-create-wizard/amendment-create-wizard.component.html @@ -1,15 +1,24 @@ - +

New amendment

-