From 1bfbebeb65c50c298da7352387304e2a4a572a81 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Wed, 3 Mar 2021 18:04:53 +0000 Subject: [PATCH] [Library | Trunk]: Add url and logoURL on dashboard git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60568 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../role-verification.component.ts | 8 ++--- sharedComponents/input/input.component.ts | 34 +++++++++++++++---- sharedComponents/input/input.module.ts | 4 ++- .../subscriber-invite.component.ts | 3 +- utils/string-utils.class.ts | 2 +- 5 files changed, 38 insertions(+), 13 deletions(-) diff --git a/role-verification/role-verification.component.ts b/role-verification/role-verification.component.ts index 1883662f..9cf0e22c 100644 --- a/role-verification/role-verification.component.ts +++ b/role-verification/role-verification.component.ts @@ -21,8 +21,8 @@ import {Composer} from "../utils/email/composer"; email, to accept the invitation request.
-
-
{{error}}
+
+ {{error}}
@@ -46,8 +46,8 @@ import {Composer} from "../utils/email/composer"; email, to accept the invitation request.
-
-
{{error}}
+
+ {{error}}>
diff --git a/sharedComponents/input/input.component.ts b/sharedComponents/input/input.component.ts index ffd4c6c9..495f5677 100644 --- a/sharedComponents/input/input.component.ts +++ b/sharedComponents/input/input.component.ts @@ -45,7 +45,7 @@ export interface Option { - +
@@ -112,10 +112,22 @@ export interface Option {
- {{formControl.errors.error}} - {{warning}} - {{note}} + + {{formControl.errors.error}} + Please provide a valid URL (e.g. https://example.com) + + + + + + Note: Prefer urls like "https://example.com/my-secure-image.png" + instead of "http://example.com/my-image.png". + Browsers may not load non secure content. + + + + +
{{label}} @@ -125,8 +137,9 @@ export interface Option { export class InputComponent implements OnInit, OnDestroy, OnChanges { /** Basic information */ @Input('formInput') formControl: AbstractControl; - @Input('type') type: 'text' | 'textarea' | 'select' | 'checkbox' | 'chips' = 'text'; + @Input('type') type: 'text' | 'URL' | 'logoURL' | 'textarea' | 'select' | 'checkbox' | 'chips' = 'text'; @Input('label') label: string; + /** Textarea options */ @Input('rows') rows: number = 3; /** Select | chips available options */ @Input('options') options: Option[]; @@ -152,6 +165,8 @@ export class InputComponent implements OnInit, OnDestroy, OnChanges { @Input() panelClass: string = null; @Input() showOptionsOnEmpty: boolean = true; @Output() focusEmitter: EventEmitter = new EventEmitter(); + /** LogoUrl information */ + public secure: boolean = true; /** Internal basic information */ public required: boolean = false; private initValue: any; @@ -187,8 +202,12 @@ export class InputComponent implements OnInit, OnDestroy, OnChanges { } reset() { + this.secure = true; this.unsubscribe(); this.initValue = HelperFunctions.copy(this.formControl.value); + if(this.type === 'logoURL') { + this.secure = (!this.initValue || this.initValue.includes('https://')); + } if (this.options && this.type === 'chips') { this.filteredOptions = of(this.options); this.searchControl = new FormControl(''); @@ -201,6 +220,9 @@ export class InputComponent implements OnInit, OnDestroy, OnChanges { } this.subscriptions.push(this.formControl.valueChanges.subscribe(value => { value = (value === '') ? null : value; + if(this.type === 'logoURL') { + this.secure = (!value || value.includes('https://')); + } if (this.initValue === value || (this.initValue === '' && value === null)) { this.formControl.markAsPristine(); } diff --git a/sharedComponents/input/input.module.ts b/sharedComponents/input/input.module.ts index fdd702d4..5b5f62a5 100644 --- a/sharedComponents/input/input.module.ts +++ b/sharedComponents/input/input.module.ts @@ -11,6 +11,7 @@ import {lock, remove_circle} from "../../utils/icons/icons"; import {MatChipsModule} from "@angular/material/chips"; import {MatAutocompleteModule} from "@angular/material/autocomplete"; import {MatIconModule} from "@angular/material/icon"; +import {SafeHtmlPipeModule} from "../../utils/pipes/safeHTMLPipe.module"; @NgModule({ imports: [ @@ -22,7 +23,8 @@ import {MatIconModule} from "@angular/material/icon"; IconsModule, MatChipsModule, MatAutocompleteModule, - MatIconModule + MatIconModule, + SafeHtmlPipeModule ], exports: [ InputComponent diff --git a/sharedComponents/subscriber-invite/subscriber-invite.component.ts b/sharedComponents/subscriber-invite/subscriber-invite.component.ts index a2a20f3d..b8cc764d 100644 --- a/sharedComponents/subscriber-invite/subscriber-invite.component.ts +++ b/sharedComponents/subscriber-invite/subscriber-invite.component.ts @@ -22,10 +22,11 @@ declare var UIkit; From:
-
+
To *:
+ Separate multiple emails with a comma
diff --git a/utils/string-utils.class.ts b/utils/string-utils.class.ts index 6b02d19e..0a14f05e 100644 --- a/utils/string-utils.class.ts +++ b/utils/string-utils.class.ts @@ -291,7 +291,7 @@ export class StringUtils { } public static urlValidator(): ValidatorFn { - return Validators.pattern(this.urlRegex); + return Validators.pattern(StringUtils.urlRegex); } public static sliceString(mystr, size: number): string {