diff --git a/dashboard/plugins/components/gateway-information/plugin-gateway-information.component.html b/dashboard/plugins/components/gateway-information/plugin-gateway-information.component.html index 488d3704..bdb5c78c 100644 --- a/dashboard/plugins/components/gateway-information/plugin-gateway-information.component.html +++ b/dashboard/plugins/components/gateway-information/plugin-gateway-information.component.html @@ -1,4 +1,4 @@ -
+
No community info available
@@ -64,8 +64,9 @@
-
- +
{{ pluginObject.title}} @@ -96,7 +97,7 @@ [attr.uk-tooltip]="'pos: bottom-right; delay: 10;'" class="uk-link-reset uk-margin-xsmall-left" [class.uk-disabled] =previewInAdmin> + [customClass]="'uk-text-meta'">
@@ -115,7 +116,7 @@ [attr.uk-tooltip]="'pos: bottom-right; delay: 10;'" class="uk-link-reset uk-margin-xsmall-left" [class.uk-disabled] =previewInAdmin> + [customClass]="'uk-text-meta'">
@@ -134,7 +135,7 @@ [attr.uk-tooltip]="'pos: bottom-right; delay: 10;'" class="uk-link-reset uk-margin-xsmall-left" [class.uk-disabled] =previewInAdmin> + [customClass]="'uk-text-meta'">
diff --git a/dashboard/plugins/components/gateway-information/plugin-gateway-information.component.ts b/dashboard/plugins/components/gateway-information/plugin-gateway-information.component.ts index bb24bf88..b1498da5 100644 --- a/dashboard/plugins/components/gateway-information/plugin-gateway-information.component.ts +++ b/dashboard/plugins/components/gateway-information/plugin-gateway-information.component.ts @@ -12,7 +12,7 @@ import {HttpClient} from "@angular/common/http"; import {Filter} from "../../../../searchPages/searchUtils/searchHelperClasses.class"; import {Router} from "@angular/router"; import {SearchResearchResultsService} from "../../../../services/searchResearchResults.service"; -import {properties} from "../../../../../../environments/environment"; +import {CustomizationService} from "../../../../services/customization.service"; export class PluginGatewayInformation extends PluginBaseInfo{ showTitle:boolean = true; @@ -36,7 +36,6 @@ export class PluginGatewayInformation extends PluginBaseInfo{ compare(oldObject): any { let newObj= super.compare(oldObject); - console.log("PluginGatewayInformation", oldObject, newObj) return newObj; } } @@ -103,8 +102,8 @@ export class PluginGatewayInformationComponent extends PluginBaseComponent x['pid'] == entity && x['isEnabled'] === true); } diff --git a/dashboard/plugins/components/gateway-information/plugin-gateway-information.form.component.ts b/dashboard/plugins/components/gateway-information/plugin-gateway-information.form.component.ts index f7528621..b9250902 100644 --- a/dashboard/plugins/components/gateway-information/plugin-gateway-information.form.component.ts +++ b/dashboard/plugins/components/gateway-information/plugin-gateway-information.form.component.ts @@ -15,7 +15,7 @@ import {PluginBaseFormComponent} from "../../utils/base-plugin.form.component";
Community info
-
Manage community info here.
+
Subjects
+
Manage community info here.
Pages & menus
@@ -146,8 +147,12 @@ import {PluginBaseFormComponent} from "../../utils/base-plugin.form.component";
-
If some information is enabled here, - but still not visible, please check related entity or page.
+
If some information is enabled here, + but still not visible, please check related entity or page. +
+
+ Change the custom section background options here. +
`, diff --git a/dashboard/plugins/components/gateway-information/plugin-gateway-information.module.ts b/dashboard/plugins/components/gateway-information/plugin-gateway-information.module.ts index be3967a4..6370b0c5 100644 --- a/dashboard/plugins/components/gateway-information/plugin-gateway-information.module.ts +++ b/dashboard/plugins/components/gateway-information/plugin-gateway-information.module.ts @@ -17,11 +17,12 @@ import {AdvancedSearchInputModule} from "../../../../sharedComponents/advanced-s import {EntitiesSelectionModule} from "../../../../searchPages/searchUtils/entitiesSelection.module"; import {QuickSelectionsModule} from "../../../../searchPages/searchUtils/quick-selections.module"; import {InputModule} from "../../../../sharedComponents/input/input.module"; +import {CustomizationServiceModule} from "../../../../services/customizationService.module"; @NgModule({ imports: [ CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule, PluginFieldEditModule, - CuratorsModule, AdvancedSearchInputModule, EntitiesSelectionModule, QuickSelectionsModule, InputModule + CuratorsModule, AdvancedSearchInputModule, EntitiesSelectionModule, QuickSelectionsModule, InputModule, CustomizationServiceModule ], providers: [ PluginsService, SearchCommunityProjectsService, SearchCommunityDataprovidersService, ZenodoCommunitiesService diff --git a/dashboard/plugins/components/graph-info/plugin-graph-info.component.html b/dashboard/plugins/components/graph-info/plugin-graph-info.component.html index 827bce8f..9aa6ef24 100644 --- a/dashboard/plugins/components/graph-info/plugin-graph-info.component.html +++ b/dashboard/plugins/components/graph-info/plugin-graph-info.component.html @@ -6,9 +6,7 @@

{{pluginObject.title}}

-
- {{pluginObject.paragraph1}} - +
@@ -22,9 +20,7 @@
-
- {{pluginObject.paragraph2}} -
+
+

diff --git a/dashboard/plugins/components/search-deposit-link/plugin-search-deposit-link.component.ts b/dashboard/plugins/components/search-deposit-link/plugin-search-deposit-link.component.ts index 41092115..1d191685 100644 --- a/dashboard/plugins/components/search-deposit-link/plugin-search-deposit-link.component.ts +++ b/dashboard/plugins/components/search-deposit-link/plugin-search-deposit-link.component.ts @@ -2,6 +2,8 @@ import {Component} from '@angular/core'; import {PluginBaseComponent, PluginBaseInfo, PluginInfoCards, PluginURL} from "../../utils/base-plugin.component"; import {OpenaireEntities} from "../../../../utils/properties/searchFields"; import {properties} from "../../../../../../environments/environment"; +import {CustomizationService} from "../../../../services/customization.service"; +import {CommunityService} from "../../../../connect/community/community.service"; export class PluginSearchDepositLink extends PluginBaseInfo{ title:string ="Search, link and deposit your research in one place"; cardInfoArray: PluginInfoCards[] = [ @@ -22,7 +24,6 @@ export class PluginSearchDepositLink extends PluginBaseInfo{ compare(oldObject): any { let newObj= super.compare(oldObject); - console.log("PluginSearchDepositLink", oldObject, newObj) return newObj; } } @@ -34,9 +35,16 @@ export class PluginSearchDepositLink extends PluginBaseInfo{ export class PluginSearchDepositLinkComponent extends PluginBaseComponent{ entities= OpenaireEntities; - constructor() { + constructor(private communityService: CommunityService, protected layoutService: CustomizationService) { super() } + ngOnInit() { + this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe( + community => { + this.getLayout(community.communityId); + + })); + } get activeCards(){ return this.pluginObject.cardInfoArray.filter( card => card.show); diff --git a/dashboard/plugins/components/search-deposit-link/plugin-search-deposit-link.form.component.ts b/dashboard/plugins/components/search-deposit-link/plugin-search-deposit-link.form.component.ts index 5371c57c..2b159628 100644 --- a/dashboard/plugins/components/search-deposit-link/plugin-search-deposit-link.form.component.ts +++ b/dashboard/plugins/components/search-deposit-link/plugin-search-deposit-link.form.component.ts @@ -32,6 +32,9 @@ import {PluginBaseFormComponent, PluginEditEvent} from "../../utils/base-plugin.

+
diff --git a/dashboard/plugins/utils/base-plugin.component.ts b/dashboard/plugins/utils/base-plugin.component.ts index 21db00dd..beeef58f 100644 --- a/dashboard/plugins/utils/base-plugin.component.ts +++ b/dashboard/plugins/utils/base-plugin.component.ts @@ -4,20 +4,24 @@ import {PluginTemplate} from "../../../utils/entities/adminTool/pluginTemplate"; import {EnvProperties} from "../../../utils/properties/env-properties"; import {properties} from 'src/environments/environment'; import {Subscriber} from "rxjs"; +import {CustomizationOptions, Layout} from "../../../connect/community/CustomizationOptions"; +import {CustomizationService} from "../../../services/customization.service"; export class PluginBaseInfo { title: string = "Lorem ipsum"; + constructor() { } - compare(oldObject){ - if(!oldObject) { + + compare(oldObject) { + if (!oldObject) { oldObject = Object.assign(this) - }else{ + } else { for (let attrKey of Object.keys(this)) { if (!oldObject[attrKey] && oldObject[attrKey] != false) { - if(typeof this[attrKey] === "string" || typeof this[attrKey] === "boolean" ){ + if (typeof this[attrKey] === "string" || typeof this[attrKey] === "boolean") { oldObject[attrKey] = this[attrKey]; - }else { + } else { oldObject[attrKey] = Object.assign(this[attrKey]) } } @@ -26,12 +30,14 @@ export class PluginBaseInfo { return oldObject; } } + export class PluginURL { - url:string; + url: string; linkText: string; - target:string; - route:boolean; - constructor(url,linkText, target = "_blank",route = false) { + target: string; + route: boolean; + + constructor(url, linkText, target = "_blank", route = false) { this.url = url; this.linkText = linkText; this.target = target; @@ -40,29 +46,35 @@ export class PluginURL { } -export class PluginInfoCards{ - tag?:string; - title:string; - description:string; - urlsArray:PluginURL[]; - image?:string; - show:boolean; +export class PluginInfoCards { + tag?: string; + title: string; + description: string; + urlsArray: PluginURL[]; + image?: string; + show: boolean; } -@Directive() - export abstract class PluginBaseComponent implements OnDestroy { - public properties: EnvProperties = properties; - @Input() plugin:Plugin; - @Input() pluginTemplate:PluginTemplate; - @Input() pluginObject:T; - @Input() previewInAdmin:boolean = false; - subscriptions = []; - constructor() { +@Directive() +export abstract class PluginBaseComponent implements OnDestroy { + public properties: EnvProperties = properties; + @Input() plugin: Plugin; + @Input() pluginTemplate: PluginTemplate; + @Input() pluginObject: T; + @Input() previewInAdmin: boolean = false; + subscriptions = []; + + customizationOptions: CustomizationOptions; + style:string =''; + fontsDarkMode:boolean = true; + protected layoutService: CustomizationService + constructor( ) { } + ngOnInit(): void { } - ngOnDestroy() { + ngOnDestroy() { this.subscriptions.forEach(subscription => { if (subscription instanceof Subscriber) { subscription.unsubscribe() @@ -76,9 +88,30 @@ export class PluginInfoCards{ }); } - isVisible(field){ + isVisible(field) { return (this.plugin && this.pluginObject && this.pluginObject[field] == true) /* plugin is on anyway */ - || (!this.plugin && this.pluginTemplate && this.pluginObject && this.pluginObject[field] == true) /* template is on */ + || (!this.plugin && this.pluginTemplate && this.pluginObject && this.pluginObject[field] == true) /* template is on */ } + getLayout(communityId) { + if (this.previewInAdmin) { + let defaultCustomizationOptions = new CustomizationOptions(CustomizationOptions.getIdentity(communityId).mainColor, CustomizationOptions.getIdentity(communityId).secondaryColor); + this.subscriptions.push(this.layoutService.getLayout(this.properties, communityId).subscribe(layout => { + layout = (layout ? layout : new Layout(communityId, defaultCustomizationOptions)); + this.customizationOptions = (layout ? CustomizationOptions.checkForObsoleteVersion(layout.layoutOptions, communityId) : Object.assign({}, defaultCustomizationOptions)); + this.setStyle() + }, error => { + this.customizationOptions = defaultCustomizationOptions; + this.setStyle(); + })); + } + } + + setStyle() { + this.style = `background-color: ` + this.customizationOptions.backgrounds.form.color + `; + background-image: ` + (this.customizationOptions.backgrounds.form.imageFile ? (Layout.getUrl(properties.utilsService + '/download/' + this.customizationOptions.backgrounds.form.imageFile)) : 'none') + `; + background-position:` + this.customizationOptions.backgrounds.form.position + `;` + this.fontsDarkMode = this.customizationOptions.backgrounds.form.fontsDarkMode; + + } } diff --git a/services/customizationService.module.ts b/services/customizationService.module.ts new file mode 100644 index 00000000..a3759734 --- /dev/null +++ b/services/customizationService.module.ts @@ -0,0 +1,17 @@ +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; +import {CustomizationService} from "./customization.service"; + + +@NgModule({ + imports: [ + CommonModule + ], + declarations: [], + providers: [ + CustomizationService + ], + exports: [] +}) +export class CustomizationServiceModule { +}