[Admin tool|Trunk]

Customization: initial customzation form, preview, actions - no api calls yet




git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@57298 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2019-10-07 14:36:53 +00:00
parent 76b825c0a2
commit aef5531945
7 changed files with 917 additions and 0 deletions

View File

@ -0,0 +1,56 @@
import {Component, EventEmitter, Input, OnInit, Output,} from '@angular/core';
@Component({
selector: 'border',
template: `
<div class="uk-grid uk-margin-remove">
<div class="uk-width-1-3 uk-margin-small-top uk-padding-remove-left"> Radius:</div>
<div class="uk-width-2-3 uk-padding-remove-left">
<input class="uk-input uk-width-small uk-margin-small-left" [(ngModel)]="radius" (ngModelChange)="borderChanged()" type="number" min="0" />
</div>
</div>
<div class="uk-grid uk-margin-remove">
<div class="uk-width-1-3 uk-margin-small-top uk-padding-remove-left"> Width:</div>
<div class="uk-width-2-3 uk-padding-remove-left">
<input class="uk-input uk-width-small uk-margin-small-left" [(ngModel)]="width" (ngModelChange)="borderChanged()" type="number" min="0" />
</div>
</div>
<div class="uk-grid uk-margin-remove">
<div class="uk-width-1-3 uk-margin-small-top uk-padding-remove-left"> Style:</div>
<div class="uk-width-2-3 uk-padding-remove-left">
<!-- <input class="uk-input uk-width-small uk-margin-small-left" [(ngModel)]="style" (ngModelChange)="borderChanged()"/>-->
<select [(ngModel)]="style" name="{{'select_type_'}}"
class="uk-select uk-width-small" (ngModelChange)="borderChanged()">
<option [value]="'solid'" >solid</option>
<option [value]="'dotted'" >dotted</option>
<option [value]="'dashed'" >dashed</option>
</select>
</div>
</div>
`
})
export class BorderComponent implements OnInit {
@Input() radius:number =0;
@Input() width:number =0;
@Input() style = 'solid';
// @Input() addMargin: boolean = false;
@Output() borderChange = new EventEmitter();
constructor() {
}
ngOnInit() {
}
borderChanged() {
this.borderChange.emit({radius:this.radius, width:this.width, style:this.style});
}
}

View File

@ -0,0 +1,38 @@
import {Component, EventEmitter, Input, OnInit, Output,} from '@angular/core';
@Component({
selector: 'color',
template: `
<div [class]="(addMargin?'uk-margin-small-top':'') + ' colorPicker'">
<div class="uk-grid uk-remove-margin">
<div class="uk-width-2-3"> {{label}}:</div>
<div class="uk-width-1-3 uk-padding-remove-left">
<input class="uk-margin-small-left uk-width-small " color-picker [colorPicker]="color" [style.background]="color"
(colorPickerChange)="color=$event; colorChanged();"/>
</div>
</div>
</div>
`
})
export class ColorComponent implements OnInit {
@Input() color = 'white';
@Input() label = 'Color';
@Input() addMargin: boolean = false;
@Output() colorChange = new EventEmitter();
constructor() {
}
ngOnInit() {
}
colorChanged() {
this.colorChange.emit(this.color);
}
}

View File

@ -0,0 +1,60 @@
import {Component, EventEmitter, Input, OnInit, Output,} from '@angular/core';
@Component({
selector: 'font-size',
template: `
<div class="uk-grid uk-margin-remove">
<div class="uk-width-1-3 uk-margin-small-top uk-padding-remove-left"> Font:</div>
<div class="uk-width-2-3 uk-padding-remove-left">
<!-- <input class="uk-input uk-width-small uk-margin-small-left" [(ngModel)]="font" (ngModelChange)="fontChanged()"/>-->
<select [(ngModel)]="font" name="{{'select_type_'}}"
class="uk-select uk-width-small" (ngModelChange)="fontChanged()">
<option [value]="'Open Sans'" >Open Sans</option>
<option [value]="'Heebo'" >Heebo</option>
<option [value]="'Heebo'" >Sura</option>
<option [value]="'sans-serif'" >sans-serif</option>
<option [value]="'serif'" >serif</option>
<option [value]="'Times New Roman'" >Times New Roman</option>
</select>
</div>
</div>
<div class="uk-grid uk-margin-remove">
<div class="uk-width-1-3 uk-margin-small-top uk-padding-remove-left"> Size:</div>
<div class="uk-width-2-3 uk-padding-remove-left">
<input class="uk-input uk-width-small uk-margin-small-left" [(ngModel)]="size" (ngModelChange)="fontChanged()" type="number" min="6" max="100"/>
</div>
</div>
<div class="uk-grid uk-margin-remove">
<div class="uk-width-1-3 uk-margin-small-top uk-padding-remove-left"> Weight:</div>
<div class="uk-width-2-3 uk-padding-remove-left">
<input class="uk-input uk-width-small uk-margin-small-left" [(ngModel)]="weight" (ngModelChange)="fontChanged()" type="number" min="400" max="1000" step="100"/>
</div>
</div>
`
})
export class FontSizeComponent implements OnInit {
@Input() font="";
@Input() size:number;
@Input() weight:number;
@Output() fontChange = new EventEmitter();
constructor( ) {
}
ngOnInit() {
}
fontChanged() {
console.log({font:this.font, size:this.size, weight:this.weight});
this.fontChange.emit({font:this.font, size:this.size, weight:this.weight});
}
}

View File

@ -0,0 +1,14 @@
import { NgModule } from '@angular/core';
import {RouterModule} from '@angular/router';
import {CustomizationComponent} from './customization.component';
import {IsCommunity} from '../../openaireLibrary/connect/communityGuard/isCommunity.guard';
import {ConnectAdminLoginGuard} from '../../openaireLibrary/connect/communityGuard/connectAdminLoginGuard.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', canActivate: [/*IsCommunity, ConnectAdminLoginGuard*/], component: CustomizationComponent}
])
]
})
export class CustomizationRoutingModule { }

View File

@ -0,0 +1,561 @@
<ng-template #applyResetButtons>
<div class="uk-margin-small">
<button class="uk-button uk-button-small uk-button-primary"
(click)="appliedCustomizationOptions=copyObject(customizationOptions);
initializeCustomizationOptions();">
<span class="uk-icon"><svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
data-svg="refresh"><path fill="none" stroke="#000" stroke-width="1.1"
d="M17.08,11.15 C17.09,11.31 17.1,11.47 17.1,11.64 C17.1,15.53 13.94,18.69 10.05,18.69 C6.16,18.68 3,15.53 3,11.63 C3,7.74 6.16,4.58 10.05,4.58 C10.9,4.58 11.71,4.73 12.46,5"></path><polyline
fill="none" stroke="#000" points="9.9 2 12.79 4.89 9.79 7.9"></polyline></svg></span>
<span> Reset</span>
</button>
<button class="uk-button uk-button-small uk-button-primary uk-float-right"
(click)="previewUrl = getCommunityUrlSatinized(appliedCustomizationOptions);">Apply
</button>
</div>
</ng-template>
<div class="uk-grid">
<div class="uk-width-1-4 uk-background-muted customizationMenuPanel uk-padding-small ">
<div *ngIf="menuSelected == 'main'" class=" ">
<div class="uk-background-primary uk-padding-small uk-light">
<a class="uk-margin-right uk-link " routerLink="/dashboard" routerLinkActive="router-link-active"
[queryParams]="{communityId: communityId }">
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
data-svg="close"><path fill="none" stroke="#000" stroke-width="1.06"
d="M16,16 L4,4"></path><path fill="none" stroke="#000"
stroke-width="1.06"
d="M16,4 L4,16"></path></svg></span>
</a>
<span> Customization</span>
</div>
<div class="">
<div class="uk-h5 uk-margin-small-top">
Style
</div>
<div class="uk-padding-small customizationMenuItems">
<ul class="uk-list uk-list-divider">
<li><a (click)="menuSelected = 'backgrounds'">Backgrounds</a></li>
<li><a (click)="menuSelected = 'fonts'">Fonts</a></li>
<li><a (click)="menuSelected = 'elements'">Elements</a></li>
<li><a (click)="menuSelected = 'identity'">Identity</a></li>
<li><a (click)="menuSelected = 'buttons'">Buttons</a></li>
</ul>
</div>
<div class="uk-h5 uk-margin-small-top">
View
</div>
<div class="uk-padding-small customizationMenuItems">
<a [href]="getCommunityUrlNewLayout(appliedCustomizationOptions)" target="_blank">Preview page</a>
</div>
<div class="uk-h5 uk-margin-small-top">
Go to
</div>
<div class="uk-padding-small customizationMenuItems">
<a [href]="communityUrl" target="_blank">Community Page</a>
</div>
</div>
</div>
<div *ngIf="menuSelected == 'backgrounds'" class=" ">
<div class="uk-background-primary uk-padding-small uk-light">
<a class="uk-margin-right uk-link " (click)="menuSelected = 'main'">
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
data-svg="arrow-left"><polyline fill="none" stroke="#000"
points="10 14 5 9.5 10 5"></polyline><line
fill="none" stroke="#000" x1="16" y1="9.5" x2="5" y2="9.52"></line></svg></span>
</a>
<span> Backgrounds</span>
</div>
<ng-container
*ngTemplateOutlet="applyResetButtons ; context: { }"></ng-container>
<div class="uk-alert uk-alert-primary uk-text-small uk-padding-small"> Tooltip ....</div>
<div class="uk-padding-small customizationMenuItems uk-margin-small">
<ul uk-accordion>
<li class="uk-open">
<a class="uk-accordion-title" href="#">Banners </a>
<div class="uk-accordion-content uk-margin-remove-top">
<!-- <div>Appereance</div>-->
<color [color]="appliedCustomizationOptions.panel.background.color" label="Background color"
(colorChange)=
" appliedCustomizationOptions.panel.background.color = $event;"></color>
<div class="uk-margin-top uk-margin-small-bottom uk-text-bold">BUTTONS & LINKS</div>
<div class=" uk-grid-small uk-child-width-auto uk-grid">
<label><input [value]="true"
[(ngModel)]="appliedCustomizationOptions.panel.onDarkBackground" name="true"
type="radio"/>
for dark background</label>
<label><input [value]="false"
[(ngModel)]="appliedCustomizationOptions.panel.onDarkBackground" name="false"
type="radio"/> for light background</label>
</div>
<div class="uk-margin-top uk-margin-small-bottom uk-text-bold">QUICK LOOK
<span class="uk-icon uk-link " (click)="appliedCustomizationOptions.panel.onDarkBackground =
customizationOptions.panel.onDarkBackground;appliedCustomizationOptions.panel.background.color =
customizationOptions.panel.background.color;">
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
data-svg="refresh"><path fill="none" stroke="#000" stroke-width="1.1"
d="M17.08,11.15 C17.09,11.31 17.1,11.47 17.1,11.64 C17.1,15.53 13.94,18.69 10.05,18.69 C6.16,18.68 3,15.53 3,11.63 C3,7.74 6.16,4.58 10.05,4.58 C10.9,4.58 11.71,4.73 12.46,5"></path><polyline
fill="none" stroke="#000" points="9.9 2 12.79 4.89 9.79 7.9"></polyline></svg>
</span>
</div>
<div class="uk-padding-small uk-text-center"
[style.background-color]="appliedCustomizationOptions.panel.background.color">
<div [style.color]="appliedCustomizationOptions.panel.title.color"
[style.font-family]="appliedCustomizationOptions.panel.title.family"
[style.font-size]="appliedCustomizationOptions.panel.title.size+'px'"
[style.font-weight]="appliedCustomizationOptions.panel.title.weight">Banner Big Text
</div>
<div [style.color]="appliedCustomizationOptions.panel.fonts.color"
[style.font-family]="appliedCustomizationOptions.panel.fonts.family"
[style.font-size]="appliedCustomizationOptions.panel.fonts.size+'px'"
[style.font-weight]="appliedCustomizationOptions.panel.fonts.weight">Banner Small Text
</div>
<div *ngIf="appliedCustomizationOptions.panel.onDarkBackground">
<a class="" [style]="linkDarkBackgroundPreview"
(mouseover)="linkDarkBackgroundPreview=changeFontsStyle(appliedCustomizationOptions.links.darkBackground, appliedCustomizationOptions.links.darkBackground.onHover.color);"
(mouseout)="linkDarkBackgroundPreview=changeFontsStyle(appliedCustomizationOptions.links.darkBackground, appliedCustomizationOptions.links.darkBackground.color);">Link</a>
<br>
<a class="uk-button" [style]="buttonDarkBackgroundPreview"
(mouseover)="buttonDarkBackgroundPreview=changeStyle(appliedCustomizationOptions.buttons.darkBackground.onHover, appliedCustomizationOptions.buttons.darkBackground);"
(mouseout)="buttonDarkBackgroundPreview=changeStyle(appliedCustomizationOptions.buttons.darkBackground);">Button</a>
</div>
<div *ngIf="!appliedCustomizationOptions.panel.onDarkBackground">
<a class="" [style]="linkLightBackgroundPreview"
(mouseover)="linkLightBackgroundPreview=changeFontsStyle(appliedCustomizationOptions.links.lightBackground,
appliedCustomizationOptions.links.lightBackground.onHover.color);"
(mouseout)="linkLightBackgroundPreview=changeFontsStyle(appliedCustomizationOptions.links.lightBackground, appliedCustomizationOptions.links.lightBackground.color);">Link</a>
<br>
<a class="uk-button" [style]="buttonLightBackgroundPreview"
(mouseover)="buttonLightBackgroundPreview=changeStyle(appliedCustomizationOptions.buttons.lightBackground.onHover, appliedCustomizationOptions.buttons.lightBackground);"
(mouseout)="buttonLightBackgroundPreview=changeStyle(appliedCustomizationOptions.buttons.lightBackground);">
Button</a>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
<div *ngIf="menuSelected == 'fonts'" class=" ">
<div class="uk-background-primary uk-padding-small uk-light">
<a class="uk-margin-right uk-link " (click)="menuSelected = 'main'">
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
data-svg="arrow-left"><polyline fill="none" stroke="#000"
points="10 14 5 9.5 10 5"></polyline><line
fill="none" stroke="#000" x1="16" y1="9.5" x2="5" y2="9.52"></line></svg></span>
</a>
<span> Fonts</span>
</div>
<ng-container
*ngTemplateOutlet="applyResetButtons ; context: { }"></ng-container>
<div class="uk-alert uk-alert-primary uk-text-small uk-padding-small"> Tooltip ....</div>
<div class="uk-padding-small customizationMenuItems uk-margin-small">
<ul uk-accordion>
<li class="uk-open">
<a class="uk-accordion-title" href="#">Banner Big Text</a>
<div class="uk-accordion-content uk-margin-remove-top">
<font-size [font]="appliedCustomizationOptions.panel.title.family"
[size]="appliedCustomizationOptions.panel.title.size"
[weight]="appliedCustomizationOptions.panel.title.weight"
(fontChange)="appliedCustomizationOptions.panel.title.family=$event.font;
appliedCustomizationOptions.panel.title.size=$event.size;
appliedCustomizationOptions.panel.title.weight=$event.weight"></font-size>
<color [color]="appliedCustomizationOptions.panel.title.color"
(colorChange)=
" appliedCustomizationOptions.panel.title.color = $event;" [addMargin]="true"></color>
<div class="uk-margin-top uk-margin-small-bottom uk-text-bold">QUICK LOOK
<span class="uk-icon uk-link " (click)="appliedCustomizationOptions.panel.title =
copyObject(customizationOptions.panel.title);">
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
data-svg="refresh"><path fill="none" stroke="#000" stroke-width="1.1"
d="M17.08,11.15 C17.09,11.31 17.1,11.47 17.1,11.64 C17.1,15.53 13.94,18.69 10.05,18.69 C6.16,18.68 3,15.53 3,11.63 C3,7.74 6.16,4.58 10.05,4.58 C10.9,4.58 11.71,4.73 12.46,5"></path><polyline
fill="none" stroke="#000" points="9.9 2 12.79 4.89 9.79 7.9"></polyline></svg>
</span>
</div>
<div class="uk-padding-small uk-text-center"
[style.background-color]="appliedCustomizationOptions.panel.background.color">
<div [style.color]="appliedCustomizationOptions.panel.title.color"
[style.font-family]="appliedCustomizationOptions.panel.title.family"
[style.font-size]="appliedCustomizationOptions.panel.title.size+'px'"
[style.font-weight]="appliedCustomizationOptions.panel.title.weight">Banner Big Text
</div>
</div>
</div>
</li>
</ul>
</div>
<div class="uk-padding-small customizationMenuItems uk-margin-small">
<ul uk-accordion>
<li>
<a class="uk-accordion-title" href="#">Banner Small Text</a>
<div class="uk-accordion-content uk-margin-remove-top">
<font-size [font]="appliedCustomizationOptions.panel.fonts.family"
[size]="appliedCustomizationOptions.panel.fonts.size"
[weight]="appliedCustomizationOptions.panel.fonts.weight"
(fontChange)="appliedCustomizationOptions.panel.fonts.family=$event.font;
appliedCustomizationOptions.panel.fonts.size=$event.size;
appliedCustomizationOptions.panel.fonts.weight=$event.weight"
></font-size>
<color [color]="appliedCustomizationOptions.panel.fonts.color"
(colorChange)=
" appliedCustomizationOptions.panel.fonts.color = $event;" [addMargin]="true"></color>
<div class="uk-margin-top uk-margin-small-bottom uk-text-bold">QUICK LOOK
<span class="uk-icon uk-link " (click)="appliedCustomizationOptions.panel.fonts =
copyObject(customizationOptions.panel.fonts);">
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
data-svg="refresh"><path fill="none" stroke="#000" stroke-width="1.1"
d="M17.08,11.15 C17.09,11.31 17.1,11.47 17.1,11.64 C17.1,15.53 13.94,18.69 10.05,18.69 C6.16,18.68 3,15.53 3,11.63 C3,7.74 6.16,4.58 10.05,4.58 C10.9,4.58 11.71,4.73 12.46,5"></path><polyline
fill="none" stroke="#000" points="9.9 2 12.79 4.89 9.79 7.9"></polyline></svg>
</span>
</div>
<div class="uk-padding-small uk-text-center"
[style.background-color]="appliedCustomizationOptions.panel.background.color">
<div [style.color]="appliedCustomizationOptions.panel.fonts.color"
[style.font-family]="appliedCustomizationOptions.panel.fonts.family"
[style.font-size]="appliedCustomizationOptions.panel.fonts.size+'px'"
[style.font-weight]="appliedCustomizationOptions.panel.fonts.weight">Banner Small Text
</div>
</div>
</div>
</li>
</ul>
</div>
<div class="uk-padding-small customizationMenuItems uk-margin-small">
<ul uk-accordion>
<li>
<a class="uk-accordion-title" href="#">Links</a>
<div class="uk-accordion-content uk-margin-remove-top">
<ul class="uk-tab" uk-switcher>
<li><a href="#">On dark <br>background</a></li>
<li><a href="#">On light <br>background</a></li>
</ul>
<ul class="uk-switcher uk-margin">
<li>
<font-size [font]="appliedCustomizationOptions.links.darkBackground.family"
[size]="appliedCustomizationOptions.links.darkBackground.size"
[weight]="appliedCustomizationOptions.links.darkBackground.weight"
(fontChange)="appliedCustomizationOptions.links.darkBackground.family=$event.font;
appliedCustomizationOptions.links.darkBackground.size=$event.size;
appliedCustomizationOptions.links.darkBackground.weight=$event.weight; linkDarkBackgroundPreview=changeFontsStyle(appliedCustomizationOptions.links.darkBackground, appliedCustomizationOptions.links.darkBackground.color);"
></font-size>
<!-- <div>Appereance</div>-->
<color [color]="appliedCustomizationOptions.links.darkBackground.color" (colorChange)=
" appliedCustomizationOptions.links.darkBackground.color = $event; linkDarkBackgroundPreview =
changeFontsStyle(appliedCustomizationOptions.links.darkBackground, appliedCustomizationOptions.links.darkBackground.color)"></color>
<div class="uk-margin-top uk-margin-small-bottom uk-text-bold">ON HOVER</div>
<color [color]="appliedCustomizationOptions.links.darkBackground.onHover.color" (colorChange)=
" appliedCustomizationOptions.links.darkBackground.onHover.color = $event;"></color>
<div class="uk-margin-top uk-margin-small-bottom uk-text-bold">QUICK LOOK
<span class="uk-icon uk-link " (click)="appliedCustomizationOptions.links.darkBackground =
copyObject(customizationOptions.links.darkBackground);">
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
data-svg="refresh"><path fill="none" stroke="#000" stroke-width="1.1"
d="M17.08,11.15 C17.09,11.31 17.1,11.47 17.1,11.64 C17.1,15.53 13.94,18.69 10.05,18.69 C6.16,18.68 3,15.53 3,11.63 C3,7.74 6.16,4.58 10.05,4.58 C10.9,4.58 11.71,4.73 12.46,5"></path><polyline
fill="none" stroke="#000" points="9.9 2 12.79 4.89 9.79 7.9"></polyline></svg>
</span>
</div>
<div class="uk-padding-small uk-text-center uk-background-primary ">
<a class="" [style]="linkDarkBackgroundPreview"
(mouseover)="linkDarkBackgroundPreview=changeFontsStyle(appliedCustomizationOptions.links.darkBackground, appliedCustomizationOptions.links.darkBackground.onHover.color);"
(mouseout)="linkDarkBackgroundPreview=changeFontsStyle(appliedCustomizationOptions.links.darkBackground, appliedCustomizationOptions.links.darkBackground.color);">Link</a>
</div>
</li>
<li>
<!-- <div>Appereance</div>-->
<color [color]="appliedCustomizationOptions.links.lightBackground.color" (colorChange)=
" appliedCustomizationOptions.links.lightBackground.color = $event; linkLightBackgroundPreview=changeFontsStyle(appliedCustomizationOptions.links.lightBackground, appliedCustomizationOptions.links.lightBackground.color);"></color>
<div class="uk-margin-top uk-margin-small-bottom uk-text-bold">ON HOVER</div>
<color [color]="appliedCustomizationOptions.links.lightBackground.onHover.color" (colorChange)=
" appliedCustomizationOptions.links.lightBackground.onHover.color = $event;"></color>
<div class="uk-margin-top uk-margin-small-bottom uk-text-bold">QUICK LOOK
<span class="uk-icon uk-link " (click)="appliedCustomizationOptions.links.lightBackground =
copyObject(customizationOptions.links.lightBackground);">
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
data-svg="refresh"><path fill="none" stroke="#000" stroke-width="1.1"
d="M17.08,11.15 C17.09,11.31 17.1,11.47 17.1,11.64 C17.1,15.53 13.94,18.69 10.05,18.69 C6.16,18.68 3,15.53 3,11.63 C3,7.74 6.16,4.58 10.05,4.58 C10.9,4.58 11.71,4.73 12.46,5"></path><polyline
fill="none" stroke="#000" points="9.9 2 12.79 4.89 9.79 7.9"></polyline></svg>
</span>
</div>
<div class="uk-padding-small uk-text-center ">
<a class="" [style]="linkLightBackgroundPreview"
(mouseover)="linkLightBackgroundPreview=changeFontsStyle(appliedCustomizationOptions.links.lightBackground,
appliedCustomizationOptions.links.lightBackground.onHover.color);"
(mouseout)="linkLightBackgroundPreview=changeFontsStyle(appliedCustomizationOptions.links.lightBackground, appliedCustomizationOptions.links.lightBackground.color);">Link</a>
</div>
</li>
</ul>
</div>
</li>
</ul>
</div>
</div>
<div *ngIf="menuSelected == 'elements'" class=" ">
<div class="uk-background-primary uk-padding-small uk-light">
<a class="uk-margin-right uk-link " (click)="menuSelected = 'main'">
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
data-svg="arrow-left"><polyline fill="none" stroke="#000"
points="10 14 5 9.5 10 5"></polyline><line
fill="none" stroke="#000" x1="16" y1="9.5" x2="5" y2="9.52"></line></svg></span></a>
<span> Elements</span>
</div>
<ng-container
*ngTemplateOutlet="applyResetButtons ; context: { }"></ng-container>
<div class="uk-alert uk-alert-primary uk-text-small uk-padding-small"> Tooltip ....</div>
<div class="uk-padding-small customizationMenuItems uk-margin-small">
<ul uk-accordion>
<li class="uk-open">
<a class="uk-accordion-title" href="#"> Subject tags & Statistics cubes</a>
<div class="uk-accordion-content uk-margin-remove-top">
<!-- <div>Appereance</div>-->
<color [color]="appliedCustomizationOptions.panel.panelElements.backgroundColor" (colorChange)=
" appliedCustomizationOptions.panel.panelElements.backgroundColor= $event;"
label="Background Color"></color>
<div class="uk-margin-small-top">FONTS</div>
<color [color]="appliedCustomizationOptions.panel.panelElements.color" (colorChange)=
" appliedCustomizationOptions.panel.panelElements.color= $event;"></color>
<div class="uk-margin-top uk-margin-small-bottom uk-text-bold">QUICK LOOK
<span class="uk-icon uk-link " (click)="appliedCustomizationOptions.panel.panelElements =
copyObject(customizationOptions.panel.panelElements);">
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
data-svg="refresh"><path fill="none" stroke="#000" stroke-width="1.1"
d="M17.08,11.15 C17.09,11.31 17.1,11.47 17.1,11.64 C17.1,15.53 13.94,18.69 10.05,18.69 C6.16,18.68 3,15.53 3,11.63 C3,7.74 6.16,4.58 10.05,4.58 C10.9,4.58 11.71,4.73 12.46,5"></path><polyline
fill="none" stroke="#000" points="9.9 2 12.79 4.89 9.79 7.9"></polyline></svg>
</span>
</div>
<div class="uk-padding-small uk-text-center"
[style.background-color]="appliedCustomizationOptions.panel.background.color">
<div class="uk-card uk-padding-small uk-margin-auto" style="width:100px; height:100px"
[style.background-color]="appliedCustomizationOptions.panel.panelElements.backgroundColor"
[style.color]="appliedCustomizationOptions.panel.panelElements.color">Statistics cube
</div>
<div class="uk-label uk-margin-top"
[style.background-color]="appliedCustomizationOptions.panel.panelElements.backgroundColor"
[style.color]="appliedCustomizationOptions.panel.panelElements.color">Subject tag
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
<div *ngIf="menuSelected == 'identity'" class=" ">
<div class="uk-background-primary uk-padding-small uk-light">
<a class="uk-margin-right uk-link " (click)="menuSelected = 'main'">
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
data-svg="arrow-left"><polyline fill="none" stroke="#000"
points="10 14 5 9.5 10 5"></polyline><line
fill="none" stroke="#000" x1="16" y1="9.5" x2="5" y2="9.52"></line></svg></span></a>
<span> Identity</span>
</div>
<ng-container
*ngTemplateOutlet="applyResetButtons ; context: { }"></ng-container>
<div class="uk-alert uk-alert-primary uk-text-small uk-padding-small"> Tooltip ....</div>
<div class="uk-padding-small customizationMenuItems uk-margin-small">
<ul uk-accordion>
<li class="uk-open">
<a class="uk-accordion-title" href="#"> Identity Color</a>
<div class="uk-accordion-content uk-margin-remove-top">
<!-- <div>Primary color</div>-->
<color [color]="appliedCustomizationOptions.mainColor" (colorChange)=
" appliedCustomizationOptions.mainColor= $event;" label="Primary color"></color>
<!-- <div class="uk-margin-small-top">Secondary color</div>-->
<color [color]="appliedCustomizationOptions.secondaryColor" (colorChange)=
" appliedCustomizationOptions.secondaryColor= $event;" label="Secondary color"></color>
<div class="uk-margin-top uk-margin-small-bottom uk-text-bold">QUICK LOOK
<span class="uk-icon uk-link " (click)="appliedCustomizationOptions.mainColor =
customizationOptions.mainColor; appliedCustomizationOptions.secondaryColor =
customizationOptions.secondaryColor; ">
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
data-svg="refresh"><path fill="none" stroke="#000" stroke-width="1.1"
d="M17.08,11.15 C17.09,11.31 17.1,11.47 17.1,11.64 C17.1,15.53 13.94,18.69 10.05,18.69 C6.16,18.68 3,15.53 3,11.63 C3,7.74 6.16,4.58 10.05,4.58 C10.9,4.58 11.71,4.73 12.46,5"></path><polyline
fill="none" stroke="#000" points="9.9 2 12.79 4.89 9.79 7.9"></polyline></svg>
</span>
</div>
TODO
</div>
</li>
</ul>
</div>
</div>
<div *ngIf="menuSelected == 'buttons'" class=" ">
<div class="uk-background-primary uk-padding-small uk-light">
<a class="uk-margin-right uk-link " (click)="menuSelected = 'main'">
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
data-svg="arrow-left"><polyline fill="none" stroke="#000"
points="10 14 5 9.5 10 5"></polyline><line
fill="none" stroke="#000" x1="16" y1="9.5" x2="5" y2="9.52"></line></svg></span></a>
<span> Buttons</span>
</div>
<ng-container
*ngTemplateOutlet="applyResetButtons ; context: { }"></ng-container>
<div class="uk-alert uk-alert-primary uk-text-small uk-padding-small"> Tooltip ....</div>
<div class="uk-padding-small customizationMenuItems uk-margin-small">
<ul uk-accordion>
<li class="uk-open">
<a class="uk-accordion-title" href="#">Buttons</a>
<div class="uk-accordion-content uk-margin-remove-top">
<ul class="uk-tab" uk-switcher>
<li><a href="#">On dark <br>background</a></li>
<li><a href="#">On light <br>background</a></li>
</ul>
<ul class="uk-switcher uk-margin">
<li>
<border [style]="appliedCustomizationOptions.buttons.darkBackground.borderStyle" [width]=
"appliedCustomizationOptions.buttons.darkBackground.borderWidth" [radius]=
"appliedCustomizationOptions.buttons.darkBackground.borderRadius" (borderChange)=
" appliedCustomizationOptions.buttons.darkBackground.borderStyle = $event.style;
appliedCustomizationOptions.buttons.darkBackground.borderRadius = $event.radius;
appliedCustomizationOptions.buttons.darkBackground.borderWidth = $event.width; buttonDarkBackgroundPreview=changeStyle(appliedCustomizationOptions.buttons.darkBackground);"></border>
<color [color]="appliedCustomizationOptions.buttons.darkBackground.color" (colorChange)=
" appliedCustomizationOptions.buttons.darkBackground.color = $event; buttonDarkBackgroundPreview=changeStyle(appliedCustomizationOptions.buttons.darkBackground);"
label="Fonts Color"
[addMargin]="true"></color>
<color [color]="appliedCustomizationOptions.buttons.darkBackground.backgroundColor" (colorChange)=
" appliedCustomizationOptions.buttons.darkBackground.backgroundColor = $event; buttonDarkBackgroundPreview=changeStyle(appliedCustomizationOptions.buttons.darkBackground);"
label="Background Color" [addMargin]="true"></color>
<color [color]="appliedCustomizationOptions.buttons.darkBackground.borderColor" (colorChange)=
" appliedCustomizationOptions.buttons.darkBackground.borderColor = $event; buttonDarkBackgroundPreview=changeStyle(appliedCustomizationOptions.buttons.darkBackground);"
label="Border Color"
[addMargin]="true"
></color>
<div class="uk-margin-top uk-margin-small-bottom uk-text-bold">ON HOVER</div>
<color [color]="appliedCustomizationOptions.buttons.darkBackground.onHover.color" (colorChange)=
" appliedCustomizationOptions.buttons.darkBackground.onHover.color = $event;" label="Fonts Color"
></color>
<color [color]="appliedCustomizationOptions.buttons.darkBackground.onHover.backgroundColor"
(colorChange)=
" appliedCustomizationOptions.buttons.darkBackground.onHover.backgroundColor = $event;"
label="Background Color" [addMargin]="true"></color>
<color [color]="appliedCustomizationOptions.buttons.darkBackground.onHover.borderColor" (colorChange)=
" appliedCustomizationOptions.buttons.darkBackground.onHover.borderColor = $event;"
label="Border Color" [addMargin]="true"></color>
<div class="uk-margin-top uk-margin-small-bottom uk-text-bold">QUICK LOOK
<span class="uk-icon uk-link " (click)="appliedCustomizationOptions.buttons.darkBackground =
copyObject(customizationOptions.buttons.darkBackground);">
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
data-svg="refresh"><path fill="none" stroke="#000" stroke-width="1.1"
d="M17.08,11.15 C17.09,11.31 17.1,11.47 17.1,11.64 C17.1,15.53 13.94,18.69 10.05,18.69 C6.16,18.68 3,15.53 3,11.63 C3,7.74 6.16,4.58 10.05,4.58 C10.9,4.58 11.71,4.73 12.46,5"></path><polyline
fill="none" stroke="#000" points="9.9 2 12.79 4.89 9.79 7.9"></polyline></svg>
</span>
</div>
<div class="uk-background-primary uk-padding-small uk-text-center">
<a class="uk-button" [style]="buttonDarkBackgroundPreview"
(mouseover)="buttonDarkBackgroundPreview=changeStyle(appliedCustomizationOptions.buttons.darkBackground.onHover, appliedCustomizationOptions.buttons.darkBackground);"
(mouseout)="buttonDarkBackgroundPreview=changeStyle(appliedCustomizationOptions.buttons.darkBackground);">Button</a>
</div>
<!-- style="{color:green;} :hover { color: red; }"-->
</li>
<li>
<border [style]="appliedCustomizationOptions.buttons.lightBackground.borderStyle" [width]=
"appliedCustomizationOptions.buttons.lightBackground.borderWidth" [radius]=
"appliedCustomizationOptions.buttons.lightBackground.borderRadius" (borderChange)=
" appliedCustomizationOptions.buttons.lightBackground.borderStyle = $event.style;
appliedCustomizationOptions.buttons.lightBackground.borderRadius = $event.radius;
appliedCustomizationOptions.buttons.lightBackground.borderWidth = $event.width;
buttonLightBackgroundPreview=changeStyle(appliedCustomizationOptions.buttons.lightBackground); "></border>
<color [color]="appliedCustomizationOptions.buttons.lightBackground.color" (colorChange)=
" appliedCustomizationOptions.buttons.lightBackground.color = $event; buttonLightBackgroundPreview=changeStyle(appliedCustomizationOptions.buttons.lightBackground);"
label="Fonts Color"
[addMargin]="true"></color>
<color [color]="appliedCustomizationOptions.buttons.lightBackground.backgroundColor" (colorChange)=
" appliedCustomizationOptions.buttons.lightBackground.backgroundColor = $event; buttonLightBackgroundPreview=changeStyle(appliedCustomizationOptions.buttons.lightBackground);"
label="Background Color" [addMargin]="true"></color>
<color [color]="appliedCustomizationOptions.buttons.lightBackground.borderColor" (colorChange)=
" appliedCustomizationOptions.buttons.lightBackground.borderColor = $event; buttonLightBackgroundPreview=changeStyle(appliedCustomizationOptions.buttons.lightBackground);"
label="Border Color"
[addMargin]="true"
></color>
<div class="uk-margin-top uk-margin-small-bottom uk-text-bold">ON HOVER</div>
<color [color]="appliedCustomizationOptions.buttons.lightBackground.onHover.color" (colorChange)=
" appliedCustomizationOptions.buttons.lightBackground.onHover.color = $event; " label="Fonts Color"
></color>
<color [color]="appliedCustomizationOptions.buttons.lightBackground.onHover.backgroundColor"
(colorChange)=
" appliedCustomizationOptions.buttons.lightBackground.onHover.backgroundColor = $event;"
label="Background Color" [addMargin]="true"></color>
<color [color]="appliedCustomizationOptions.buttons.lightBackground.onHover.borderColor"
(colorChange)=
" appliedCustomizationOptions.buttons.lightBackground.onHover.borderColor = $event;"
label="Border Color" [addMargin]="true"></color>
<div class="uk-margin-top uk-margin-small-bottom uk-text-bold">QUICK LOOK
<span class="uk-icon uk-link " (click)="appliedCustomizationOptions.buttons.lightBackground =
copyObject(customizationOptions.buttons.lightBackground);">
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
data-svg="refresh"><path fill="none" stroke="#000" stroke-width="1.1"
d="M17.08,11.15 C17.09,11.31 17.1,11.47 17.1,11.64 C17.1,15.53 13.94,18.69 10.05,18.69 C6.16,18.68 3,15.53 3,11.63 C3,7.74 6.16,4.58 10.05,4.58 C10.9,4.58 11.71,4.73 12.46,5"></path><polyline
fill="none" stroke="#000" points="9.9 2 12.79 4.89 9.79 7.9"></polyline></svg>
</span>
</div>
<div class=" uk-padding-small uk-text-center">
<a class="uk-button" [style]="buttonLightBackgroundPreview"
(mouseover)="buttonLightBackgroundPreview=changeStyle(appliedCustomizationOptions.buttons.lightBackground.onHover, appliedCustomizationOptions.buttons.lightBackground);"
(mouseout)="buttonLightBackgroundPreview=changeStyle(appliedCustomizationOptions.buttons.lightBackground);">
Button</a>
</div>
</li>
</ul>
</div>
</li>
</ul>
</div>
</div>
<button class="uk-button uk-margin uk-button-primary uk-button-small uk-align-right"
(click)="customizationOptions=copyObject(appliedCustomizationOptions);
initializeCustomizationOptions();">
Publish
</button>
</div>
<div class="uk-width-3-4">
<iframe [src]="previewUrl" class="" width="100%" height="100%"></iframe>
</div>
</div>

View File

@ -0,0 +1,158 @@
import {Component, ElementRef, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
import {Session} from '../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
import {Curator} from '../../openaireLibrary/utils/entities/CuratorInfo';
import {DomSanitizer} from '@angular/platform-browser';
import {CustomizationOptions} from '../../openaireLibrary/connect/community/CustomizationOptions';
import {StringUtils} from '../../openaireLibrary/utils/string-utils.class';
@Component({
selector: 'customization',
templateUrl: './customization.component.html',
})
export class CustomizationComponent implements OnInit {
menuSelected = 'main';
color = 'white';
communityUrl = 'http://scoobydoo.di.uoa.gr:4200/?communityId=ee';
customizationOptions: CustomizationOptions = new CustomizationOptions();
appliedCustomizationOptions: CustomizationOptions = this.copyObject(this.customizationOptions);
previewUrl = this.getCommunityUrlSatinized(this.appliedCustomizationOptions);
buttonDarkBackgroundPreview;
buttonLightBackgroundPreview;
linkDarkBackgroundPreview;
linkLightBackgroundPreview;
public showLoading = true;
public updateErrorMessage = '';
public successfulSaveMessage = '';
public curatorsEnabled;
public newCurator;
public communityId = null;
public affiliationsChanged = false;
public hasChanged = false;
public curatorId = null;
public curator: Curator = null;
public photo: any = null;
public properties: EnvProperties = null;
private file: File = null;
private maxsize: number = 200 * 1024;
public enabled = true;
private deletePhoto = false;
constructor(private element: ElementRef,
private route: ActivatedRoute,
private _router: Router,
private sanitizer: DomSanitizer) {
}
ngOnInit() {
this.initializeCustomizationOptions();
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
if (!Session.isLoggedIn()) {
this._router.navigate(['/user-info'], {
queryParams: {'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url}
});
} else {
this.route.queryParams.subscribe((params) => {
this.communityId = params['communityId'];
this.showLoading = true;
this.updateErrorMessage = '';
// this.curatorId = Session.getUser().id;
});
}
});
}
initializeCustomizationOptions() {
this.buttonDarkBackgroundPreview = this.changeStyle(this.appliedCustomizationOptions.buttons.darkBackground);
this.buttonLightBackgroundPreview = this.changeStyle(this.appliedCustomizationOptions.buttons.lightBackground);
this.linkDarkBackgroundPreview = this.changeFontsStyle(this.appliedCustomizationOptions.links.darkBackground, this.appliedCustomizationOptions.links.darkBackground.color);
this.linkLightBackgroundPreview = this.changeStyle(this.appliedCustomizationOptions.links.lightBackground, this.appliedCustomizationOptions.links.lightBackground.color);
// this.previewUrl = this.getCommunityUrlSatinized(this.appliedCustomizationOptions);
}
changeStyle(colorOptions, borderOptions=null) {
let style = '';
if(!borderOptions){
borderOptions = colorOptions;
}
if (colorOptions.color) {
style += '; color:' + colorOptions.color;
}
if (colorOptions.backgroundColor) {
style += '; background-color:' + colorOptions.backgroundColor;
}
if (colorOptions.borderColor) {
style += '; border-color:' + colorOptions.borderColor;
}
if (borderOptions.borderStyle) {
style += '; border-style:' + borderOptions.borderStyle;
}
if (borderOptions.borderWidth) {
style += '; border-width:' + borderOptions.borderWidth+'px';
}
if (borderOptions.borderRadius) {
style += '; border-radius:' + borderOptions.borderRadius+'px';
}
return this.sanitizer.bypassSecurityTrustStyle(style);
}
changeFontsStyle(options, color=null) {
let style = '';
if (options.family) {
style += '; font-family:' + options.family;
}
if (options.size) {
style += '; font-size:' + options.size+'px';
}
if (options.weight) {
style += '; font-weight:' + options.weight;
}
if (color) {
style += '; color:' + color;
}
return this.sanitizer.bypassSecurityTrustStyle(style);
}
getCommunityUrlSatinized(customization: CustomizationOptions) {
return this.sanitizer.bypassSecurityTrustResourceUrl(this.getCommunityUrlNewLayout(customization));
}
getCommunityUrlNewLayout(customization: CustomizationOptions) {
// console.log("here!");
let layout = JSON.stringify(customization);
// console.log(layout);
return this.communityUrl + '&layout=' + StringUtils.URIEncode(layout);
}
copyObject(obj){
return JSON.parse(JSON.stringify(obj));
}
resetBackgroundsBanners(){
this.appliedCustomizationOptions.panel.onDarkBackground = this.customizationOptions.panel.onDarkBackground;
this.appliedCustomizationOptions.panel.background.color = this.customizationOptions.panel.background.color;
}
}

View File

@ -0,0 +1,30 @@
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms';
import {RouterModule} from '@angular/router';
import {CustomizationComponent} from './customization.component';
import {CustomizationRoutingModule} from './customization-routing.module';
// import {IsCommunity} from '../../openaireLibrary/connect/communityGuard/isCommunity.guard';
// import {ConnectAdminLoginGuard} from '../../openaireLibrary/connect/communityGuard/connectAdminLoginGuard.guard';
import { ColorPickerModule } from 'ngx-color-picker';
import {FontSizeComponent} from './FontSize.component';
import {ColorComponent} from './Color.component';
import {BorderComponent} from './Border.component';
@NgModule({
imports: [
CustomizationRoutingModule, CommonModule, FormsModule, RouterModule, ColorPickerModule
],
declarations: [
CustomizationComponent, FontSizeComponent, ColorComponent, BorderComponent
],
providers: [
],
exports: [
CustomizationComponent
]
})
export class CustomizationModule { }