Merge branch 'new-theme' of code-repo.d4science.org:MaDgIK/openaire-library into new-theme

This commit is contained in:
Konstantinos Triantafyllou 2022-07-25 11:16:10 +03:00
commit dd9f893e2f
8 changed files with 46 additions and 6 deletions

View File

@ -1,11 +1,37 @@
import {properties} from "../../../../environments/environment";
export class Layout { export class Layout {
_id:string; _id:string;
portalPid:string; portalPid:string;
layoutOptions:CustomizationOptions; layoutOptions:CustomizationOptions;
date;
constructor(community, options:CustomizationOptions){ constructor(community, options:CustomizationOptions){
this.portalPid = community; this.portalPid = community;
this.layoutOptions = options; this.layoutOptions = options;
} }
public static getVariables(options: CustomizationOptions): {} | null {
if(options) {
let variables = {};
if(options.identity) {
variables['@global-primary-background'] = options.identity.mainColor;
variables['@global-secondary-background'] = options.identity.secondaryColor;
variables['@primary-color'] = options.identity.mainColor;
variables['@secondary-color'] = options.identity.secondaryColor;
}
if(options.backgrounds){
variables['@general-search-form-background'] = options.backgrounds.form.color;
variables['@general-search-form-background-image'] = (options.backgrounds.form.imageFile?(this.getUrl(properties.utilsService + '/download/' +options.backgrounds.form.imageFile)): 'none') ;
variables['@base-body-background'] = options.backgrounds.light.color;
}
return variables;
}
return null;
}
public static getUrl(url){
return 'url("' + url + '")';
}
} }
export class CustomizationOptions { export class CustomizationOptions {
identity: { identity: {

View File

@ -18,7 +18,7 @@ export class ConnectHelper {
if ( domain.indexOf('beta') !== -1) { if ( domain.indexOf('beta') !== -1) {
domain = domain.substr(domain.indexOf('.') + 1, domain.length); domain = domain.substr(domain.indexOf('.') + 1, domain.length);
domain = domain.substr(0, domain.indexOf('.')); domain = domain.substr(0, domain.indexOf('.'));
} else if (domain.indexOf('test.') !== -1) { } else if (domain.indexOf('test.') !== -1 && !(properties.adminToolsPortalType == "connect" || properties.adminToolsPortalType == "community")) {
return null; return null;
} else { } else {
domain = domain.substr(0, domain.indexOf('.')); domain = domain.substr(0, domain.indexOf('.'));

View File

@ -66,7 +66,7 @@
{{item.type == 'external' ? item.url : item.route}} {{item.type == 'external' ? item.url : item.route}}
</div> </div>
<div *ngIf="item.type == 'internal' && item.route && pageStatus != null && !pageStatus.get(item.route)" class="uk-text-small uk-text-warning uk-margin-small-top"> <div *ngIf="item.type == 'internal' && item.route && pageStatus != null && !pageStatus.get(item.route)" class="uk-text-small uk-text-warning uk-margin-small-top">
This menu item is not visible because the page is disabled This menu item will not visible because the page is disabled
</div> </div>
</div> </div>
<div class="uk-flex uk-flex-middle uk-flex-center"> <div class="uk-flex uk-flex-middle uk-flex-center">

View File

@ -374,7 +374,9 @@ export class MenuComponent implements OnInit {
public moveElement(index: number, newIndex: number, children: MenuItemExtended[] = []) { public moveElement(index: number, newIndex: number, children: MenuItemExtended[] = []) {
this.elements.init(); this.elements.init();
this.subElements.init(); if(children && children.length) {
this.subElements.init();
}
if(this.selectedMenuType == 'customMenu') { if(this.selectedMenuType == 'customMenu') {
let temp = HelperFunctions.copy(this.featuredMenuItems); let temp = HelperFunctions.copy(this.featuredMenuItems);
HelperFunctions.swap(temp, index, newIndex); HelperFunctions.swap(temp, index, newIndex);

View File

@ -1,3 +1,5 @@
import {properties} from "../../../../environments/environment";
export class SearchUtilsClass{ export class SearchUtilsClass{
page:number = 1; page:number = 1;
size:number = 10; size:number = 10;
@ -27,6 +29,9 @@ export class SearchCustomFilter{
selected:boolean; selected:boolean;
promptToAddFilter:boolean; promptToAddFilter:boolean;
constructor( fieldName:string, queryFieldName:string, valueId:string, valueName:string ){ constructor( fieldName:string, queryFieldName:string, valueId:string, valueName:string ){
if(valueId == "test" && properties.environment == "development"){
valueId = "covid-19";
}
this.isHiddenFilter = true; this.isHiddenFilter = true;
this.fieldName = fieldName; this.fieldName = fieldName;
this.queryFieldName = queryFieldName; this.queryFieldName = queryFieldName;

View File

@ -20,6 +20,9 @@ export class LayoutService {
} }
} }
} }
createCSS( pid: string, suffix = null, layout = null): Observable<any> {
return this.http.post("http://scoobydoo.di.uoa.gr:4200/build-css/" + (layout?"preview/":"") + pid + (suffix?("/"+ suffix):""), layout );
}
saveLayout(properties: EnvProperties, pid: string, layout: Layout): Observable<Layout> { saveLayout(properties: EnvProperties, pid: string, layout: Layout): Observable<Layout> {
LayoutService.removeNulls(layout); LayoutService.removeNulls(layout);

View File

@ -180,7 +180,7 @@
</ng-container> </ng-container>
<!-- Custom menu items --> <!-- Custom menu items -->
<!-- TODO: Add to mobile menu as well! --> <!-- TODO: Add to mobile menu as well! -->
<ng-container *ngIf="additionalMenuItems?.length > 0 && properties.environment == 'development'"> <ng-container *ngIf="isMenuEnabled && additionalMenuItems?.length > 0">
<ng-container *ngFor="let menu of additionalMenuItems"> <ng-container *ngFor="let menu of additionalMenuItems">
<li class="uk-parent" [class.uk-active]="isTheActiveMenu(menu)"> <li class="uk-parent" [class.uk-active]="isTheActiveMenu(menu)">
<!-- INTERNAL ROOT--> <!-- INTERNAL ROOT-->
@ -235,8 +235,8 @@
</nav> </nav>
</div> </div>
</div> </div>
<!-- New navbar for featured menu items - test only --> <!-- New navbar for featured menu items only -->
<ng-container *ngIf="featuredMenuItems?.length > 0 && properties.environment == 'development'"> <ng-container *ngIf="isFeaturedMenuEnabled && featuredMenuItems?.length > 0">
<div class="uk-background-primary uk-light"> <div class="uk-background-primary uk-light">
<div class="uk-container uk-container-expand"> <div class="uk-container uk-container-expand">
<div class="uk-navbar" uk-navbar> <div class="uk-navbar" uk-navbar>

View File

@ -56,6 +56,8 @@ export class NavigationBarComponent implements OnInit, OnDestroy {
public additionalMenuItems: MenuItem[] = []; public additionalMenuItems: MenuItem[] = [];
public featuredMenuItems: MenuItem[] = []; public featuredMenuItems: MenuItem[] = [];
public isMenuEnabled: boolean = false;
public isFeaturedMenuEnabled: boolean = false;
constructor(private router: Router, constructor(private router: Router,
private route: ActivatedRoute, private route: ActivatedRoute,
@ -119,6 +121,8 @@ export class NavigationBarComponent implements OnInit, OnDestroy {
this.subs.push( this.subs.push(
this._helpContentService.getMenuItems(this.portal).subscribe( this._helpContentService.getMenuItems(this.portal).subscribe(
data => { data => {
this.isMenuEnabled = data.isMenuEnabled;
this.isFeaturedMenuEnabled = data.isFeaturedMenuEnabled;
this.featuredMenuItems = data.featuredMenuItems; this.featuredMenuItems = data.featuredMenuItems;
this.additionalMenuItems = data.menuItems; this.additionalMenuItems = data.menuItems;
}, },