From b0d51878d061f6038798f433273a22df6ec2c1e5 Mon Sep 17 00:00:00 2001 From: Florent Poittevin <florent.poittevin@unige.ch> Date: Fri, 25 Oct 2019 09:07:18 +0200 Subject: [PATCH] feat: add button on admin page to go back to list --- .../admin-funding-agencies-detail.routable.html | 13 +++++++++++-- .../admin-institution-detail.routable.html | 13 +++++++++++-- .../admin-license-detail.routable.html | 13 +++++++++++-- .../admin-oauth2-client-detail.routable.html | 13 +++++++++++-- .../admin-orgunit-detail.routable.html | 13 +++++++++++-- .../admin-person-detail.routable.html | 13 +++++++++++-- .../admin-preservation-policy-detail.routable.html | 13 +++++++++++-- .../admin-role-detail.routable.html | 10 +++++++++- .../admin-submission-policy-detail.routable.html | 13 +++++++++++-- .../admin-user-detail.routable.html | 13 +++++++++++-- .../deposit-detail/deposit-detail.routable.html | 2 +- .../deposit-detail/deposit-detail.routable.ts | 4 ---- .../orgunit-detail/orgunit-detail.routable.html | 10 +++++++++- .../shared-abstract-detail.routable.ts | 6 ++++++ src/app/shared/utils/store-route-local.util.ts | 12 ++++++++++++ src/assets/i18n/de.json | 6 +++--- src/assets/i18n/en.json | 4 ++-- src/assets/i18n/fr.json | 4 ++-- 18 files changed, 143 insertions(+), 32 deletions(-) diff --git a/src/app/features/admin/funding-agencies/components/routables/admin-funding-agencies-detail/admin-funding-agencies-detail.routable.html b/src/app/features/admin/funding-agencies/components/routables/admin-funding-agencies-detail/admin-funding-agencies-detail.routable.html index 7799d770d..e31bb67b0 100644 --- a/src/app/features/admin/funding-agencies/components/routables/admin-funding-agencies-detail/admin-funding-agencies-detail.routable.html +++ b/src/app/features/admin/funding-agencies/components/routables/admin-funding-agencies-detail/admin-funding-agencies-detail.routable.html @@ -1,15 +1,24 @@ <div class="button-toolbar"> - <button mat-flat-button + <button mat-button + color="accent" + (click)="backToList()" + > + <mat-icon>navigate_before</mat-icon> + {{KEY_BACK_BUTTON | translate}} + </button> + <button mat-button color="primary" (click)="edit()" > + <mat-icon>edit</mat-icon> {{KEY_EDIT_BUTTON | translate}} </button> - <button mat-flat-button + <button mat-button color="accent" [disabled]="!(currentObs| async)" (click)="delete()" > + <mat-icon>delete</mat-icon> {{KEY_DELETE_BUTTON | translate}} </button> </div> diff --git a/src/app/features/admin/institution/components/routables/admin-institution-detail/admin-institution-detail.routable.html b/src/app/features/admin/institution/components/routables/admin-institution-detail/admin-institution-detail.routable.html index a2e398205..dce938234 100644 --- a/src/app/features/admin/institution/components/routables/admin-institution-detail/admin-institution-detail.routable.html +++ b/src/app/features/admin/institution/components/routables/admin-institution-detail/admin-institution-detail.routable.html @@ -1,15 +1,24 @@ <div class="button-toolbar"> - <button mat-flat-button + <button mat-button + color="accent" + (click)="backToList()" + > + <mat-icon>navigate_before</mat-icon> + {{KEY_BACK_BUTTON | translate}} + </button> + <button mat-button color="primary" (click)="edit()" > + <mat-icon>edit</mat-icon> {{KEY_EDIT_BUTTON | translate}} </button> - <button mat-flat-button + <button mat-button color="accent" [disabled]="!(currentObs| async)" (click)="delete()" > + <mat-icon>delete</mat-icon> {{KEY_DELETE_BUTTON | translate}} </button> </div> diff --git a/src/app/features/admin/license/components/routables/admin-license-detail/admin-license-detail.routable.html b/src/app/features/admin/license/components/routables/admin-license-detail/admin-license-detail.routable.html index f78a51774..99777a20d 100644 --- a/src/app/features/admin/license/components/routables/admin-license-detail/admin-license-detail.routable.html +++ b/src/app/features/admin/license/components/routables/admin-license-detail/admin-license-detail.routable.html @@ -1,15 +1,24 @@ <div class="button-toolbar"> - <button mat-flat-button + <button mat-button + color="accent" + (click)="backToList()" + > + <mat-icon>navigate_before</mat-icon> + {{KEY_BACK_BUTTON | translate}} + </button> + <button mat-button color="primary" (click)="edit()" > + <mat-icon>edit</mat-icon> {{KEY_EDIT_BUTTON | translate}} </button> - <button mat-flat-button + <button mat-button color="accent" [disabled]="!(currentObs| async)" (click)="delete()" > + <mat-icon>delete</mat-icon> {{KEY_DELETE_BUTTON | translate}} </button> </div> diff --git a/src/app/features/admin/oauth2-client/components/routables/admin-oauth2-client-detail/admin-oauth2-client-detail.routable.html b/src/app/features/admin/oauth2-client/components/routables/admin-oauth2-client-detail/admin-oauth2-client-detail.routable.html index 075c0d70b..86cc37f4c 100644 --- a/src/app/features/admin/oauth2-client/components/routables/admin-oauth2-client-detail/admin-oauth2-client-detail.routable.html +++ b/src/app/features/admin/oauth2-client/components/routables/admin-oauth2-client-detail/admin-oauth2-client-detail.routable.html @@ -1,15 +1,24 @@ <div class="button-toolbar"> - <button mat-flat-button + <button mat-button + color="accent" + (click)="backToList()" + > + <mat-icon>navigate_before</mat-icon> + {{KEY_BACK_BUTTON | translate}} + </button> + <button mat-button color="primary" (click)="edit()" > + <mat-icon>edit</mat-icon> {{KEY_EDIT_BUTTON | translate}} </button> - <button mat-flat-button + <button mat-button color="accent" [disabled]="!(currentObs| async)" (click)="delete()" > + <mat-icon>delete</mat-icon> {{KEY_DELETE_BUTTON | translate}} </button> </div> diff --git a/src/app/features/admin/orgunit/components/routables/admin-orgunit-detail/admin-orgunit-detail.routable.html b/src/app/features/admin/orgunit/components/routables/admin-orgunit-detail/admin-orgunit-detail.routable.html index e6c282d13..0923b7b68 100644 --- a/src/app/features/admin/orgunit/components/routables/admin-orgunit-detail/admin-orgunit-detail.routable.html +++ b/src/app/features/admin/orgunit/components/routables/admin-orgunit-detail/admin-orgunit-detail.routable.html @@ -1,15 +1,24 @@ <div class="button-toolbar"> - <button mat-flat-button + <button mat-button + color="accent" + (click)="backToList()" + > + <mat-icon>navigate_before</mat-icon> + {{KEY_BACK_BUTTON | translate}} + </button> + <button mat-button color="primary" (click)="edit()" > + <mat-icon>edit</mat-icon> {{KEY_EDIT_BUTTON | translate}} </button> - <button mat-flat-button + <button mat-button color="accent" [disabled]="!(currentObs| async)" (click)="delete()" > + <mat-icon>delete</mat-icon> {{KEY_DELETE_BUTTON | translate}} </button> </div> diff --git a/src/app/features/admin/person/components/routables/admin-person-detail/admin-person-detail.routable.html b/src/app/features/admin/person/components/routables/admin-person-detail/admin-person-detail.routable.html index c13def6a5..419df60e4 100644 --- a/src/app/features/admin/person/components/routables/admin-person-detail/admin-person-detail.routable.html +++ b/src/app/features/admin/person/components/routables/admin-person-detail/admin-person-detail.routable.html @@ -1,15 +1,24 @@ <div class="button-toolbar"> - <button mat-flat-button + <button mat-button + color="accent" + (click)="backToList()" + > + <mat-icon>navigate_before</mat-icon> + {{KEY_BACK_BUTTON | translate}} + </button> + <button mat-button color="primary" (click)="edit()" > + <mat-icon>edit</mat-icon> {{KEY_EDIT_BUTTON | translate}} </button> - <button mat-flat-button + <button mat-button color="accent" [disabled]="!(currentObs| async)" (click)="delete()" > + <mat-icon>delete</mat-icon> {{KEY_DELETE_BUTTON | translate}} </button> </div> diff --git a/src/app/features/admin/preservation-policy/components/routables/admin-preservation-policy-detail/admin-preservation-policy-detail.routable.html b/src/app/features/admin/preservation-policy/components/routables/admin-preservation-policy-detail/admin-preservation-policy-detail.routable.html index 577a85f02..56809c955 100644 --- a/src/app/features/admin/preservation-policy/components/routables/admin-preservation-policy-detail/admin-preservation-policy-detail.routable.html +++ b/src/app/features/admin/preservation-policy/components/routables/admin-preservation-policy-detail/admin-preservation-policy-detail.routable.html @@ -1,15 +1,24 @@ <div class="button-toolbar"> - <button mat-flat-button + <button mat-button + color="accent" + (click)="backToList()" + > + <mat-icon>navigate_before</mat-icon> + {{KEY_BACK_BUTTON | translate}} + </button> + <button mat-button color="primary" (click)="edit()" > + <mat-icon>edit</mat-icon> {{KEY_EDIT_BUTTON | translate}} </button> - <button mat-flat-button + <button mat-button color="accent" [disabled]="!(currentObs| async)" (click)="delete()" > + <mat-icon>delete</mat-icon> {{KEY_DELETE_BUTTON | translate}} </button> </div> diff --git a/src/app/features/admin/role/components/routables/admin-role-detail/admin-role-detail.routable.html b/src/app/features/admin/role/components/routables/admin-role-detail/admin-role-detail.routable.html index 8a1983dd6..03db9a3b3 100644 --- a/src/app/features/admin/role/components/routables/admin-role-detail/admin-role-detail.routable.html +++ b/src/app/features/admin/role/components/routables/admin-role-detail/admin-role-detail.routable.html @@ -1,8 +1,16 @@ <div class="button-toolbar"> - <button mat-flat-button + <button mat-button + color="accent" + (click)="backToList()" + > + <mat-icon>navigate_before</mat-icon> + {{KEY_BACK_BUTTON | translate}} + </button> + <button mat-button color="primary" (click)="edit()" > + <mat-icon>edit</mat-icon> {{KEY_EDIT_BUTTON | translate}} </button> </div> diff --git a/src/app/features/admin/submission-policy/components/routables/admin-submission-policy-detail/admin-submission-policy-detail.routable.html b/src/app/features/admin/submission-policy/components/routables/admin-submission-policy-detail/admin-submission-policy-detail.routable.html index 90ef8d322..e1465f473 100644 --- a/src/app/features/admin/submission-policy/components/routables/admin-submission-policy-detail/admin-submission-policy-detail.routable.html +++ b/src/app/features/admin/submission-policy/components/routables/admin-submission-policy-detail/admin-submission-policy-detail.routable.html @@ -1,15 +1,24 @@ <div class="button-toolbar"> - <button mat-flat-button + <button mat-button + color="accent" + (click)="backToList()" + > + <mat-icon>navigate_before</mat-icon> + {{KEY_BACK_BUTTON | translate}} + </button> + <button mat-button color="primary" (click)="edit()" > + <mat-icon>edit</mat-icon> {{KEY_EDIT_BUTTON | translate}} </button> - <button mat-flat-button + <button mat-button color="accent" [disabled]="!(currentObs| async)" (click)="delete()" > + <mat-icon>delete</mat-icon> {{KEY_DELETE_BUTTON | translate}} </button> </div> diff --git a/src/app/features/admin/user/components/routables/admin-user-detail/admin-user-detail.routable.html b/src/app/features/admin/user/components/routables/admin-user-detail/admin-user-detail.routable.html index 293a36152..388c58fd5 100644 --- a/src/app/features/admin/user/components/routables/admin-user-detail/admin-user-detail.routable.html +++ b/src/app/features/admin/user/components/routables/admin-user-detail/admin-user-detail.routable.html @@ -1,15 +1,24 @@ <div class="button-toolbar"> - <button mat-flat-button + <button mat-button + color="accent" + (click)="backToList()" + > + <mat-icon>navigate_before</mat-icon> + {{KEY_BACK_BUTTON | translate}} + </button> + <button mat-button color="primary" (click)="edit()" > + <mat-icon>edit</mat-icon> {{KEY_EDIT_BUTTON | translate}} </button> - <button mat-flat-button + <button mat-button color="accent" [disabled]="!(currentObs| async)" (click)="delete()" > + <mat-icon>delete</mat-icon> {{KEY_DELETE_BUTTON | translate}} </button> </div> diff --git a/src/app/features/deposit/components/routables/deposit-detail/deposit-detail.routable.html b/src/app/features/deposit/components/routables/deposit-detail/deposit-detail.routable.html index 20854e16f..540489e37 100644 --- a/src/app/features/deposit/components/routables/deposit-detail/deposit-detail.routable.html +++ b/src/app/features/deposit/components/routables/deposit-detail/deposit-detail.routable.html @@ -37,7 +37,7 @@ (click)="backToList()" > <mat-icon>navigate_before</mat-icon> - {{'deposit.backToList' | translate}} + {{KEY_BACK_BUTTON | translate}} </button> <button *ngIf="canDoAlterationActions && ((currentObs| async)?.status === statusEnum.INPROGRESS || (currentObs| async)?.status === statusEnum.INERROR)" diff --git a/src/app/features/deposit/components/routables/deposit-detail/deposit-detail.routable.ts b/src/app/features/deposit/components/routables/deposit-detail/deposit-detail.routable.ts index 363a0a149..f49ed04b2 100644 --- a/src/app/features/deposit/components/routables/deposit-detail/deposit-detail.routable.ts +++ b/src/app/features/deposit/components/routables/deposit-detail/deposit-detail.routable.ts @@ -263,8 +263,4 @@ export class DepositDetailRoutable extends SharedAbstractDetailRoutable<DepositE } return true; } - - backToList(): void { - this.store.dispatch(new Navigate([RoutesEnum.deposit])); - } } diff --git a/src/app/features/organizational-unit/components/routables/orgunit-detail/orgunit-detail.routable.html b/src/app/features/organizational-unit/components/routables/orgunit-detail/orgunit-detail.routable.html index 16e03ca0c..f0a9f722e 100644 --- a/src/app/features/organizational-unit/components/routables/orgunit-detail/orgunit-detail.routable.html +++ b/src/app/features/organizational-unit/components/routables/orgunit-detail/orgunit-detail.routable.html @@ -1,8 +1,16 @@ <div class="button-toolbar"> - <button mat-flat-button + <button mat-button + color="accent" + (click)="backToList()" + > + <mat-icon>navigate_before</mat-icon> + {{KEY_BACK_BUTTON | translate}} + </button> + <button mat-button color="primary" (click)="edit()" > + <mat-icon>edit</mat-icon> {{KEY_EDIT_BUTTON | translate}} </button> </div> diff --git a/src/app/shared/components/routables/shared-abstract-detail/shared-abstract-detail.routable.ts b/src/app/shared/components/routables/shared-abstract-detail/shared-abstract-detail.routable.ts index c6aa49f1e..f1e337b2a 100644 --- a/src/app/shared/components/routables/shared-abstract-detail/shared-abstract-detail.routable.ts +++ b/src/app/shared/components/routables/shared-abstract-detail/shared-abstract-detail.routable.ts @@ -22,6 +22,7 @@ import { ResourceNameSpace, ResourceStateModel, StoreUtil, + TRANSLATE, } from "solidify-frontend"; import {LocalStateEnum} from "../../../enums/local-state.enum"; @@ -32,6 +33,7 @@ export abstract class SharedAbstractDetailRoutable<TResourceModel, UResourceStat abstract readonly KEY_PARAM_NAME: string; abstract readonly KEY_EDIT_BUTTON: string; abstract readonly KEY_DELETE_BUTTON: string; + readonly KEY_BACK_BUTTON: string = TRANSLATE("app.navigation.button.backToList"); protected _resId: string; @@ -93,6 +95,10 @@ export abstract class SharedAbstractDetailRoutable<TResourceModel, UResourceStat data: datas, }); } + + backToList(): void { + this.store.dispatch(new Navigate([StoreRouteLocalUtil.getRootRoute(this.state)])); + } } export interface OptionSharedAbstractCreateRoutable { diff --git a/src/app/shared/utils/store-route-local.util.ts b/src/app/shared/utils/store-route-local.util.ts index 70a971632..6f175e4e8 100644 --- a/src/app/shared/utils/store-route-local.util.ts +++ b/src/app/shared/utils/store-route-local.util.ts @@ -101,12 +101,24 @@ export class StoreRouteLocalUtil { if (state === LocalStateEnum.admin_license) { return RoutesEnum.adminLicense; } + if (state === LocalStateEnum.admin_institution) { + return RoutesEnum.adminInstitution; + } if (state === LocalStateEnum.admin_user) { return RoutesEnum.adminUser; } + if (state === LocalStateEnum.admin_oauth2Client) { + return RoutesEnum.adminOAuth2client; + } if (state === LocalStateEnum.admin_person) { return RoutesEnum.adminPerson; } + if (state === LocalStateEnum.admin_role) { + return RoutesEnum.adminRole; + } + if (state === LocalStateEnum.admin_fundingAgencies) { + return RoutesEnum.adminFundingAgencies; + } throw Error(StringUtil.format(StoreRouteLocalUtil.messageNotFound, "Root", state)); } diff --git a/src/assets/i18n/de.json b/src/assets/i18n/de.json index 03e216747..da25a9077 100644 --- a/src/assets/i18n/de.json +++ b/src/assets/i18n/de.json @@ -476,7 +476,8 @@ }, "navigation": { "button": { - "backToDetail": "Leave edit mode" + "backToDetail": "Leave edit mode", + "backToList": "app.navigation.button.backToList" } }, "person": { @@ -641,7 +642,6 @@ "title": "Authors" }, "backToEdit": "Return to editing", - "backToList": "Deposit list", "collectionBegin": "Data Collection Start Date", "collectionEnd": "Data Collection End Date", "delete": "Delete", @@ -1056,4 +1056,4 @@ } } } -} +} \ No newline at end of file diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 03e216747..7fa355f97 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -476,7 +476,8 @@ }, "navigation": { "button": { - "backToDetail": "Leave edit mode" + "backToDetail": "Leave edit mode", + "backToList": "Back to list" } }, "person": { @@ -641,7 +642,6 @@ "title": "Authors" }, "backToEdit": "Return to editing", - "backToList": "Deposit list", "collectionBegin": "Data Collection Start Date", "collectionEnd": "Data Collection End Date", "delete": "Delete", diff --git a/src/assets/i18n/fr.json b/src/assets/i18n/fr.json index e110e4de4..9a801c8a4 100644 --- a/src/assets/i18n/fr.json +++ b/src/assets/i18n/fr.json @@ -476,7 +476,8 @@ }, "navigation": { "button": { - "backToDetail": "Quitter le mode édition" + "backToDetail": "Quitter le mode édition", + "backToList": "Retour à la liste" } }, "person": { @@ -641,7 +642,6 @@ "title": "Auteurs" }, "backToEdit": "Retour en édition", - "backToList": "Liste des dépôts", "collectionBegin": "Début de la collecte des données", "collectionEnd": "Fin de la collecte des données", "delete": "Supprimer", -- GitLab