From 4625ebf9674e4ffd185bcbee050737b99f690cc4 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Mon, 27 Jun 2022 15:50:21 +0300 Subject: [PATCH] Finish UI of class help texts list, edit page/class help content --- .../class-help-content-form.component.html | 126 +++++++------- .../class-help-content-form.component.ts | 1 + .../class-help-contents.component.html | 2 +- dashboard/entity/entities.component.html | 2 +- .../page-help-content-form.component.html | 121 +++++++------- .../page-help-content-form.component.ts | 1 + .../page-help-contents.component.html | 157 +++++++----------- .../helpTexts/page-help-contents.component.ts | 1 + dashboard/page/pages.component.html | 2 +- dashboard/page/pages.component.ts | 27 +-- .../admin-tabs/admin-tabs.component.ts | 10 +- utils/string-utils.class.ts | 2 +- 12 files changed, 198 insertions(+), 254 deletions(-) diff --git a/dashboard/divhelpcontent/class-help-content-form.component.html b/dashboard/divhelpcontent/class-help-content-form.component.html index d3f7bbea..cbffeb41 100644 --- a/dashboard/divhelpcontent/class-help-content-form.component.html +++ b/dashboard/divhelpcontent/class-help-content-form.component.html @@ -1,78 +1,66 @@ -
+
-
- - - Go back to class help texts list - +
+
+ + + +
+
+ Admin Dashboard - {{pageHelpContent ? 'Update ' : 'Add new '}} class help text +
+

{{page.name}} (unsaved changes)

+
+
+
+ + +
-
-
-
-
{{pageHelpContent ? 'Update ' : 'Add new '}} class help text
-
- {{page.name}} - (unsaved changes) -
-
-
- - -
+
+ + +
+
-
-
-
- - - +
+ +
+ + +
+ +
+ +
diff --git a/dashboard/divhelpcontent/class-help-content-form.component.ts b/dashboard/divhelpcontent/class-help-content-form.component.ts index 164d48dc..c07ca64c 100644 --- a/dashboard/divhelpcontent/class-help-content-form.component.ts +++ b/dashboard/divhelpcontent/class-help-content-form.component.ts @@ -32,6 +32,7 @@ export class ClassContentFormComponent implements OnInit { @Input() updateErrorMessage: string = ''; private subs: Subscription[] = []; public pageHelpContent: DivHelpContent; + public stickyPageHeader: boolean = false; constructor(private route: ActivatedRoute, private _router: Router, private _fb: FormBuilder, private _helpContentService: HelpContentService) { } diff --git a/dashboard/divhelpcontent/class-help-contents.component.html b/dashboard/divhelpcontent/class-help-contents.component.html index 92e2b711..14e579f8 100644 --- a/dashboard/divhelpcontent/class-help-contents.component.html +++ b/dashboard/divhelpcontent/class-help-contents.component.html @@ -2,7 +2,7 @@
- +
diff --git a/dashboard/entity/entities.component.html b/dashboard/entity/entities.component.html index cf6f25ed..f2bb141b 100644 --- a/dashboard/entity/entities.component.html +++ b/dashboard/entity/entities.component.html @@ -1,7 +1,7 @@
- +
diff --git a/dashboard/helpTexts/page-help-content-form.component.html b/dashboard/helpTexts/page-help-content-form.component.html index 5dca4220..a6d08477 100644 --- a/dashboard/helpTexts/page-help-content-form.component.html +++ b/dashboard/helpTexts/page-help-content-form.component.html @@ -1,75 +1,68 @@ -
+
-
- - - Go back to page help texts list - +
+
+ + + +
+
+ Admin Dashboard - {{pageHelpContent ? 'Update ' : 'Add new '}} page help text +
+

{{page.name}} (unsaved changes)

+
+
+
+ + +
-
-
-
-
{{pageHelpContent ? 'Update ' : 'Add new '}} page help text
-
- {{page.name}} - (unsaved changes) -
-
-
- - -
+
+
+
-
-
-
-
diff --git a/dashboard/helpTexts/page-help-content-form.component.ts b/dashboard/helpTexts/page-help-content-form.component.ts index ce2b1ec6..efee85d6 100644 --- a/dashboard/helpTexts/page-help-content-form.component.ts +++ b/dashboard/helpTexts/page-help-content-form.component.ts @@ -28,6 +28,7 @@ export class PageContentFormComponent implements OnInit { public showLoading: boolean = true; private subs: Subscription[] = []; public pageHelpContent: PageHelpContent; + public stickyPageHeader: boolean = false; constructor(private route: ActivatedRoute, private _router: Router, private _fb: FormBuilder, private _helpContentService: HelpContentService) { } diff --git a/dashboard/helpTexts/page-help-contents.component.html b/dashboard/helpTexts/page-help-contents.component.html index cde4ddbb..d7012096 100644 --- a/dashboard/helpTexts/page-help-contents.component.html +++ b/dashboard/helpTexts/page-help-contents.component.html @@ -1,56 +1,15 @@ -
+
-
- {{page.name}} -
-
- - - - - - Back to pages list - + - -
- - {{getSelectedPageHelpContents().length}} pages selected - Actions -
- +
+ Admin Dashboard - Manage page help texts +
+

{{page.name}}

@@ -59,62 +18,72 @@
-
-
    -
  • -
    -
    -
    -
    -
    -
    -
    -
    {{check.pageHelpContent.page.name}}
    + +
    +
    +
    +
    +
    +
    +
    +
    +

    {{check.pageHelpContent.content | htmlToString}}

    -
    -

    {{check.pageHelpContent.content|htmlToString}}

    -
    -
    -
    - Placement: {{check.pageHelpContent.placement}} +
    + Placement: {{check.pageHelpContent.placement}}
    -
    - Order: {{check.pageHelpContent.order}} -
    -
    - Enable/disable: - +
    + Order: {{check.pageHelpContent.order}}
    -
    -
    -
    -
    -
    - -
    +
    +
    +
    + +
    +
    -
  • -
-
-
-
No page help texts found
+
+
+
+
No page help texts found
+
diff --git a/dashboard/helpTexts/page-help-contents.component.ts b/dashboard/helpTexts/page-help-contents.component.ts index 31609e3b..2a1a785b 100644 --- a/dashboard/helpTexts/page-help-contents.component.ts +++ b/dashboard/helpTexts/page-help-contents.component.ts @@ -45,6 +45,7 @@ export class PageHelpContentsComponent implements OnInit { public filterForm: FormControl; private subscriptions: any[] = []; public selectedKeyword: string; + public stickyPageHeader: boolean = false; @ViewChild('searchInputComponent') searchInputComponent: SearchInputComponent; constructor(private element: ElementRef, private route: ActivatedRoute, private router: Router, private _helpService: HelpContentService, private _fb: FormBuilder, private sanitizer: DomSanitizer) { diff --git a/dashboard/page/pages.component.html b/dashboard/page/pages.component.html index 458ba3c0..7ef758e7 100644 --- a/dashboard/page/pages.component.html +++ b/dashboard/page/pages.component.html @@ -1,7 +1,7 @@
- +
diff --git a/dashboard/page/pages.component.ts b/dashboard/page/pages.component.ts index 3a086dd8..28f50784 100644 --- a/dashboard/page/pages.component.ts +++ b/dashboard/page/pages.component.ts @@ -418,25 +418,16 @@ export class PagesComponent implements OnInit { } public togglePages(status: boolean, ids: string[]) { - if (!Session.isLoggedIn()) { - this._router.navigate(['/user-info'], { - queryParams: { - 'errorCode': LoginErrorCodes.NOT_VALID, - 'redirectUrl': this._router.url + this.subscriptions.push(this._helpContentService.togglePages(this.portal, ids, status, this.properties.adminToolsAPIURL).subscribe( + () => { + for (let id of ids) { + let i = this.checkboxes.findIndex(_ => _.page._id == id); + this.checkboxes[i].page.isEnabled = status; } - }); - } else { - this.subscriptions.push(this._helpContentService.togglePages(this.portal, ids, status, this.properties.adminToolsAPIURL).subscribe( - () => { - for (let id of ids) { - let i = this.checkboxes.findIndex(_ => _.page._id == id); - this.checkboxes[i].page.isEnabled = status; - } - this.applyCheck(false); - }, - error => this.handleUpdateError('System error changing the status of the selected page(s)', error) - )); - } + this.applyCheck(false); + }, + error => this.handleUpdateError('System error changing the status of the selected page(s)', error) + )); } selectAll() { diff --git a/dashboard/sharedComponents/admin-tabs/admin-tabs.component.ts b/dashboard/sharedComponents/admin-tabs/admin-tabs.component.ts index 183764fc..bbc58d8f 100644 --- a/dashboard/sharedComponents/admin-tabs/admin-tabs.component.ts +++ b/dashboard/sharedComponents/admin-tabs/admin-tabs.component.ts @@ -9,11 +9,11 @@ import { properties } from 'src/environments/environment'; selector: 'admin-tabs', template: ` ` }) diff --git a/utils/string-utils.class.ts b/utils/string-utils.class.ts index 8531d334..75046e4a 100644 --- a/utils/string-utils.class.ts +++ b/utils/string-utils.class.ts @@ -311,7 +311,7 @@ export class StringUtils { } public static getLogoUrl(result: Stakeholder | CommunityInfo): string { - if(result.logoUrl) { + if(result && result.logoUrl) { return (result.isUpload)?(properties.utilsService + '/download/' + result.logoUrl):result.logoUrl; } else { return "assets/common-assets/placeholder.png";