Customization: save and build css
on preview create preview css
This commit is contained in:
parent
20c2760f3f
commit
4b5bd584ae
|
@ -6,7 +6,7 @@
|
||||||
<a>
|
<a>
|
||||||
<div (click)="close()" class="uk-flex uk-flex-middle uk-flex-center">
|
<div (click)="close()" class="uk-flex uk-flex-middle uk-flex-center">
|
||||||
<div class="uk-width-auto">
|
<div class="uk-width-auto">
|
||||||
<icon *ngIf="menuSelected.id != 'home'" class="menu-icon" name="west" ratio="2"
|
<icon *ngIf="menuSelected.id != 'home'" class="menu-icon" name="west" ratio="2"
|
||||||
[flex]="true"></icon>
|
[flex]="true"></icon>
|
||||||
<icon *ngIf="menuSelected.id == 'home'" class="menu-icon" name="close" ratio="2"
|
<icon *ngIf="menuSelected.id == 'home'" class="menu-icon" name="close" ratio="2"
|
||||||
[flex]="true"></icon>
|
[flex]="true"></icon>
|
||||||
|
@ -124,7 +124,8 @@
|
||||||
<div id="container" class=" uk-flex uk-flex-center uk-flex-middle">
|
<div id="container" class=" uk-flex uk-flex-center uk-flex-middle">
|
||||||
<div id="iframecontainer" class="">
|
<div id="iframecontainer" class="">
|
||||||
<div class="uk-height-1-1">
|
<div class="uk-height-1-1">
|
||||||
<div class=" uk-width-1-1 refresh-indicator">
|
<div *ngIf="hasChanges(draftCustomizationOptions, appliedCustomizationOptions)"
|
||||||
|
class=" uk-width-1-1 refresh-indicator">
|
||||||
<div class="uk-position-relative uk-height-1-1">
|
<div class="uk-position-relative uk-height-1-1">
|
||||||
<div class="uk-position-center uk-text-center clickable uk-h3" style="color:white"
|
<div class="uk-position-center uk-text-center clickable uk-h3" style="color:white"
|
||||||
(click)="applyLayout()">
|
(click)="applyLayout()">
|
||||||
|
@ -300,4 +301,4 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<modal-alert #leaveModal [overflowBody]="false" (alertOutput)="confirmClose()" ></modal-alert>
|
<modal-alert #leaveModal [overflowBody]="false" (alertOutput)="confirmClose()"></modal-alert>
|
||||||
|
|
|
@ -162,19 +162,30 @@ sidebarItems = [{name:"Identity", id : "identity", icon: "desktop_windows" },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.publishedLayout.layoutOptions = this.draftCustomizationOptions;
|
this.publishedLayout.layoutOptions = this.draftCustomizationOptions;
|
||||||
|
this.publishedLayout.date = new Date();
|
||||||
this.subscriptions.push(this.layoutService.saveLayout(this.properties, this.communityId, this.publishedLayout).subscribe(layout => {
|
this.subscriptions.push(this.layoutService.saveLayout(this.properties, this.communityId, this.publishedLayout).subscribe(layout => {
|
||||||
this.deleteOldImages();
|
|
||||||
this.publishedLayout = layout;
|
|
||||||
this.publishedCustomizationOptions = layout.layoutOptions;
|
|
||||||
this.initializeCustomizationOptions(JSON.stringify(this.publishedCustomizationOptions) != this.previewCustomization);
|
this.initializeCustomizationOptions(JSON.stringify(this.publishedCustomizationOptions) != this.previewCustomization);
|
||||||
UIkit.notification("Customizations was succesfully saved!", {
|
this.deleteOldImages();
|
||||||
status: 'success',
|
this.publishedCustomizationOptions = layout.layoutOptions;
|
||||||
timeout: 6000,
|
this.subscriptions.push(this.layoutService.createCSS(this.communityId, this.publishedLayout.date.valueOf()).subscribe(data => {
|
||||||
pos: 'bottom-right'
|
console.log(data)
|
||||||
});
|
UIkit.notification("Customizations was successfully saved!", {
|
||||||
|
status: 'success',
|
||||||
|
timeout: 6000,
|
||||||
|
pos: 'bottom-right'
|
||||||
|
});
|
||||||
|
}, error => {
|
||||||
|
|
||||||
|
UIkit.notification("An error occurred on save css", {
|
||||||
|
status: 'danger',
|
||||||
|
timeout: 6000,
|
||||||
|
pos: 'bottom-right'
|
||||||
|
});
|
||||||
|
}));
|
||||||
}, error => {
|
}, error => {
|
||||||
|
|
||||||
UIkit.notification("An error occured on save", {
|
UIkit.notification("An error occurred on save layout", {
|
||||||
status: 'danger',
|
status: 'danger',
|
||||||
timeout: 6000,
|
timeout: 6000,
|
||||||
pos: 'bottom-right'
|
pos: 'bottom-right'
|
||||||
|
@ -212,7 +223,21 @@ sidebarItems = [{name:"Identity", id : "identity", icon: "desktop_windows" },
|
||||||
applyLayout() {
|
applyLayout() {
|
||||||
this.appliedCustomizationOptions = this.copyObject(this.draftCustomizationOptions);
|
this.appliedCustomizationOptions = this.copyObject(this.draftCustomizationOptions);
|
||||||
if(JSON.stringify(this.appliedCustomizationOptions) != this.previewCustomization){
|
if(JSON.stringify(this.appliedCustomizationOptions) != this.previewCustomization){
|
||||||
this.previewUrl = this.getCommunityUrlSatinized(JSON.stringify(this.appliedCustomizationOptions));
|
let d = new Date();
|
||||||
|
let prefix = "-preview-" + d.valueOf();
|
||||||
|
this.subscriptions.push(this.layoutService.createCSS(this.communityId, prefix, this.appliedCustomizationOptions).subscribe(data => {
|
||||||
|
this.previewUrl = this.getCommunityUrlSatinized(this.communityId + prefix);
|
||||||
|
console.log(data)
|
||||||
|
|
||||||
|
}, error => {
|
||||||
|
|
||||||
|
UIkit.notification("An error occurred preview layout", {
|
||||||
|
status: 'danger',
|
||||||
|
timeout: 6000,
|
||||||
|
pos: 'bottom-right'
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,18 +297,16 @@ sidebarItems = [{name:"Identity", id : "identity", icon: "desktop_windows" },
|
||||||
this.resetButtonsTo(tmp.buttons);
|
this.resetButtonsTo(tmp.buttons);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getCommunityUrlSatinized(layout: string) {
|
getCommunityUrlSatinized(prefix: string) {
|
||||||
return this.sanitizer.bypassSecurityTrustResourceUrl(this.getCommunityUrlNewLayout(layout));
|
return this.sanitizer.bypassSecurityTrustResourceUrl(this.getCommunityUrl(prefix));
|
||||||
}
|
}
|
||||||
getCommunityUrl() {
|
getCommunityUrl(prefix) {
|
||||||
return 'https://'+ (this.properties.environment == 'production'?'':'beta.')+this.communityId+'.openaire.eu';
|
if(this.properties.environment == 'production' || this.properties.environment == 'beta')
|
||||||
// return "https://example.com"
|
return 'https://'+ (this.properties.environment == 'production'?'':'beta.')+this.communityId+'.openaire.eu' + (prefix?("?previewLayout=" + prefix):"");
|
||||||
|
return "http://scoobydoo.di.uoa.gr:4200" + (prefix?("?previewLayout=" + prefix):"");
|
||||||
}
|
}
|
||||||
|
|
||||||
getCommunityUrlNewLayout(layout: string) {
|
|
||||||
this.previewCustomization = layout;
|
|
||||||
return this.getCommunityUrl()+'/preview/?' + 'layout=' + StringUtils.URIEncode(layout);
|
|
||||||
}
|
|
||||||
|
|
||||||
copyObject(obj) {
|
copyObject(obj) {
|
||||||
return JSON.parse(JSON.stringify(obj));
|
return JSON.parse(JSON.stringify(obj));
|
||||||
|
|
Loading…
Reference in New Issue