From 286b90d6a7a7a99dc36bffd2acf80c69232ee65c Mon Sep 17 00:00:00 2001 From: apapachristou Date: Mon, 2 Sep 2019 11:19:16 +0300 Subject: [PATCH] Restyles DMP new version page --- .../app/ui/dmp/clone/dmp-clone.component.html | 7 +-- .../app/ui/dmp/clone/dmp-clone.component.ts | 11 +++++ dmp-frontend/src/app/ui/dmp/dmp.routing.ts | 3 +- .../general-tab/general-tab.component.html | 49 +++++++------------ .../general-tab/general-tab.component.ts | 5 ++ .../editor/grant-tab/grant-tab.component.html | 4 +- .../editor/grant-tab/grant-tab.component.scss | 8 +++ .../editor/grant-tab/grant-tab.component.ts | 8 ++- 8 files changed, 56 insertions(+), 39 deletions(-) diff --git a/dmp-frontend/src/app/ui/dmp/clone/dmp-clone.component.html b/dmp-frontend/src/app/ui/dmp/clone/dmp-clone.component.html index ad53b656a..76348bf34 100644 --- a/dmp-frontend/src/app/ui/dmp/clone/dmp-clone.component.html +++ b/dmp-frontend/src/app/ui/dmp/clone/dmp-clone.component.html @@ -6,7 +6,8 @@

{{ formGroup.get('label').value }}

- {{ 'DMP-LISTING.ACTIONS.CLONE' | translate}}   + {{ 'DMP-LISTING.ACTIONS.CLONE' | translate}}   + {{ 'DMP-LISTING.ACTIONS.NEW-VERSION' | translate}}   {{ 'GENERAL.PREPOSITIONS.OF' | translate}} {{ parentDmpLabel }}
@@ -18,14 +19,14 @@ view_agenda {{ 'SIDE-BAR.GENERAL' | translate }} - + work_outline {{ 'DMP-LISTING.COLUMNS.GRANT' | translate }} - + diff --git a/dmp-frontend/src/app/ui/dmp/clone/dmp-clone.component.ts b/dmp-frontend/src/app/ui/dmp/clone/dmp-clone.component.ts index 9e7495f45..0ac94d15a 100644 --- a/dmp-frontend/src/app/ui/dmp/clone/dmp-clone.component.ts +++ b/dmp-frontend/src/app/ui/dmp/clone/dmp-clone.component.ts @@ -30,6 +30,7 @@ export class DmpCloneComponent extends BaseComponent implements OnInit { isPublic: false; selectedTab = 0; parentDmpLabel: string; + isNewVersion: boolean = false; constructor( private route: ActivatedRoute, @@ -57,6 +58,16 @@ export class DmpCloneComponent extends BaseComponent implements OnInit { this.formGroup = this.dmp.buildForm(); this.parentDmpLabel = this.formGroup.get('label').value; + if (this.route.routeConfig.path.startsWith('new_version/')) { + this.formGroup.get('version').setValue(this.formGroup.get('version').value + 1); + this.formGroup.controls['label'].disable(); + this.formGroup.controls['grant'].disable(); + this.isNewVersion = true; + } else if (this.route.routeConfig.path.startsWith('clone/')) { + this.formGroup.get('label').setValue(this.dmp.label + " New"); + this.isNewVersion = false; + } + const breadCrumbs = []; breadCrumbs.push({ parentComponentName: null, label: this.language.instant('NAV-BAR.MY-DMPS'), url: "/plans" }); breadCrumbs.push({ parentComponentName: 'DmpListingComponent', label: this.dmp.label, url: '/plans/clone/' + this.dmp.id }); diff --git a/dmp-frontend/src/app/ui/dmp/dmp.routing.ts b/dmp-frontend/src/app/ui/dmp/dmp.routing.ts index 5cef1d992..7bd555b5d 100644 --- a/dmp-frontend/src/app/ui/dmp/dmp.routing.ts +++ b/dmp-frontend/src/app/ui/dmp/dmp.routing.ts @@ -66,7 +66,8 @@ const routes: Routes = [ }, { path: 'new_version/:id', - component: DmpWizardComponent, + // component: DmpWizardComponent, + component: DmpCloneComponent, data: { clone: false, breadcrumb: true diff --git a/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.html b/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.html index 227d596f1..ed9f4be98 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.html +++ b/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.html @@ -3,8 +3,7 @@
- + {{formGroup.get('label').getError('backendError').message}} @@ -14,8 +13,7 @@
-
@@ -99,13 +84,13 @@
+ edit + Click here to edit +
+
+ history + Click here to view previous versions +
-->
diff --git a/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.ts b/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.ts index 02bfca39a..d1c3891d7 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.ts @@ -29,6 +29,7 @@ import { startWith } from 'rxjs/internal/operators'; export class GeneralTabComponent extends BaseComponent implements OnInit { @Input() formGroup: FormGroup = null; + @Input() isNewVersion: boolean; filteringOrganisationsAsync = false; filteringResearchersAsync = false; @@ -59,6 +60,10 @@ export class GeneralTabComponent extends BaseComponent implements OnInit { if (this.formGroup.get('definition')) { this.selectedDmpProfileDefinition = this.formGroup.get('definition').value; } this.registerFormEventsForDmpProfile(); + if (this.isNewVersion) { + this.formGroup.get('label').disable(); + } + this.dmpProfileAutoCompleteConfiguration = { filterFn: this.dmpProfileSearch.bind(this), initialItems: (extraData) => this.dmpProfileSearch(''), diff --git a/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.html b/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.html index 9bc118398..885fc22ab 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.html +++ b/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.html @@ -66,11 +66,11 @@
-
+
settings_backup_restore {{'QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.ACTIONS.EXIST-GRANT' | translate}}
-
+
add {{'QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.ACTIONS.CREATE-NEW-GRANT' | translate}}
diff --git a/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.scss b/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.scss index c61311679..0ee135a89 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.scss +++ b/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.scss @@ -25,3 +25,11 @@ width: 100%; left: 0; } + +.disabled-toggle { + display: flex; + align-self: center; + padding-bottom: 1em; + cursor: default; + color: #e0e0e0; +} diff --git a/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.ts b/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.ts index 08f208f2e..3d0e071a5 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.ts @@ -23,6 +23,8 @@ export class GrantTabComponent implements OnInit { @Input() projectFormGroup: FormGroup; @Input() funderFormGroup: FormGroup; @Input() isFinalized: boolean; + @Input() isNewVersion: boolean; + isCreateNew = false; isCreateNewProject = false; isCreateNewFunder = false; @@ -101,7 +103,8 @@ export class GrantTabComponent implements OnInit { return this.funderService.getWithExternal(funderRequestItem) } - create() { + createGrant() { + if (this.isNewVersion) { return }; this.isCreateNew = !this.isCreateNew; this.setValidators(); } @@ -126,6 +129,9 @@ export class GrantTabComponent implements OnInit { this.grantformGroup.get('label').disable(); this.grantformGroup.get('description').disable(); } + if (this.isNewVersion) { + this.grantformGroup.get('label').disable(); + } else { this.grantformGroup.get('existGrant').enable(); this.grantformGroup.get('label').disable();