From 5e4890d55f1b2e8d9cff030ea2481344ac004e6f Mon Sep 17 00:00:00 2001 From: Flavie L Date: Wed, 14 Oct 2020 17:00:27 +0200 Subject: [PATCH] feat(header+dialog): create button in the header + dialog box (#320) Co-authored-by: flaurens --- src/app/main/dialog/dialog.component.html | 17 ++++++++++++++- src/app/main/header/header.component.html | 4 ++++ src/app/main/header/header.component.ts | 26 ++++++++++++++++++++++- src/assets/i18n/en.json | 16 ++++++++++++++ src/assets/style/_elements.scss | 9 ++++++++ 5 files changed, 70 insertions(+), 2 deletions(-) diff --git a/src/app/main/dialog/dialog.component.html b/src/app/main/dialog/dialog.component.html index 01a90a5e27..1cc9bd5b18 100644 --- a/src/app/main/dialog/dialog.component.html +++ b/src/app/main/dialog/dialog.component.html @@ -230,11 +230,26 @@ + + +
+ + + The component {{data.mode}} is not implemented yet. + + + + +
+
- The component{{data.mode}} is not implemented yet. + The component {{data.mode}} is not implemented yet.
diff --git a/src/app/main/header/header.component.html b/src/app/main/header/header.component.html index 798c4224b4..87ee899571 100644 --- a/src/app/main/header/header.component.html +++ b/src/app/main/header/header.component.html @@ -34,6 +34,10 @@

DSP

+ + diff --git a/src/app/main/header/header.component.ts b/src/app/main/header/header.component.ts index f26903a5ee..cdb5dba6fb 100644 --- a/src/app/main/header/header.component.ts +++ b/src/app/main/header/header.component.ts @@ -1,10 +1,12 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; +import { MatDialog, MatDialogConfig } from '@angular/material/dialog'; import { MatIconRegistry } from '@angular/material/icon'; import { DomSanitizer } from '@angular/platform-browser'; import { NavigationStart, Router } from '@angular/router'; import { DspMessageData, SearchParams, SessionService } from '@dasch-swiss/dsp-ui'; -import { ComponentCommunicationEventService, Events } from 'src/app/main/services/component-communication-event.service'; import { Subscription } from 'rxjs'; +import { DialogComponent } from 'src/app/main/dialog/dialog.component'; +import { ComponentCommunicationEventService, Events } from 'src/app/main/services/component-communication-event.service'; const { version: appVersion } = require('../../../../package.json'); @@ -34,6 +36,7 @@ export class HeaderComponent implements OnInit, OnDestroy{ private _session: SessionService, private _domSanitizer: DomSanitizer, private _matIconRegistry: MatIconRegistry, + private _dialog: MatDialog, private _router: Router, private _componentCommsService: ComponentCommunicationEventService) { @@ -117,6 +120,27 @@ export class HeaderComponent implements OnInit, OnDestroy{ } + openDialog(mode: string, name?: string, iri?: string): void { + const dialogConfig: MatDialogConfig = { + width: '640px', + position: { + top: '112px' + }, + data: { mode: mode, title: name, id: iri } + }; + + const dialogRef = this._dialog.open( + DialogComponent, + dialogConfig + ); + + dialogRef.afterClosed().subscribe(() => { + + // do something + + }); + } + } diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index aeba23adf9..aa4e39ecb2 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -153,6 +153,22 @@ "title": { "delete": "Delete list" } + }, + "resource": { + "title": { + "new": "Create new", + "edit": "Update resource", + "profile": "Resource", + "editSuccess": "You have successfully updated this resource.", + "delete": "Delete this resource", + "deleteHint": "You're sure to delete this resource?", + "deleteButton": "Delete resource now", + "formWizard": { + "step_1": "Select your resource", + "step_2": "Add properties", + "step_3": "Confirm" + } + } } } } diff --git a/src/assets/style/_elements.scss b/src/assets/style/_elements.scss index 6a15117e08..b72101f8d7 100644 --- a/src/assets/style/_elements.scss +++ b/src/assets/style/_elements.scss @@ -99,6 +99,15 @@ a, } } +.new-resource { + width: 64px !important ; + align-content: center; + + &:hover { + background-color: #EBEBEB; + } +} + // -------------------------------------- //