[master | FIXED]: Fix glitch with styles and dubbed sidabar items.

This commit is contained in:
Konstantinos Triantafyllou 2024-01-11 16:04:38 +02:00
parent 4533970798
commit 5e47e4c237
2 changed files with 81 additions and 76 deletions

View File

@ -58,12 +58,13 @@ export class AdminComponent extends SidebarBaseComponent implements OnInit {
this.stakeholder = stakeholder;
this.setProperties(this.stakeholder.alias, this.stakeholder.type);
this.layoutService.setRootClass(this.stakeholder.type);
this.sideBarItems = [];
this.sideBarItems.push(new MenuItem("general", "General", "", "/admin/" + this.stakeholder.alias, false, [], [], {}, {name: 'badge'}));
this.sideBarItems.push(new MenuItem("indicators", "Indicators", "", "/admin/" + this.stakeholder.alias + '/indicators', false, [], [], {}, {name: 'bar_chart'}, null, "uk-visible@m"));
if (this.stakeholder.defaultId) {
this.sideBarItems.push(new MenuItem("users", "Users", "", "/admin/" + this.stakeholder.alias + '/users', false, [], [], {}, {name: 'group'}, null, "uk-visible@m", "/admin/" + this.stakeholder.alias + "/users"));
}
if (this.isAdmin) {
if (this.isAdmin && this.stakeholder.defaultId) {
this.sideBarItems.push(new MenuItem("admin-tools", "Pages & Entities", "", "/admin/" + this.stakeholder.alias + "/admin-tools/pages", false, [], [], {}, {name: 'description'}, null, "uk-visible@m", "/admin/" + this.stakeholder.alias + "/admin-tools"));
}
if (this.hasAdminMenu) {

View File

@ -1,4 +1,4 @@
import {ChangeDetectorRef, Component, OnInit} from '@angular/core';
import {AfterViewInit, ChangeDetectorRef, Component, OnInit} from '@angular/core';
import {ActivatedRoute, Router} from "@angular/router";
import {MenuItem} from "./openaireLibrary/sharedComponents/menu";
import {Header} from "./openaireLibrary/sharedComponents/navigationBar.component";
@ -20,13 +20,13 @@ import {ConnectHelper} from "./openaireLibrary/connect/connectHelper";
@Component({
selector: 'app-root',
template: `
<div class="uk-background-default">
<navbar *ngIf="hasHeader" portal="irish_monitor" [menuItems]="menuItems" [showMenu]="true"
[header]="header" [user]="user" [userMenuItems]="userMenuItems"></navbar>
<div *ngIf="loading">
<loading [full]="true"></loading>
</div>
<div *ngIf="!loading" class="uk-background-default">
<navbar *ngIf="hasHeader" portal="irish_monitor" [menuItems]="menuItems" [showMenu]="true"
[header]="header" [user]="user" [userMenuItems]="userMenuItems"></navbar>
<div [ngClass]="rootClass">
<div [class.uk-hidden]="loading" [ngClass]="rootClass">
<div id="modal-container"></div>
<main>
<router-outlet></router-outlet>
@ -44,15 +44,6 @@ import {ConnectHelper} from "./openaireLibrary/connect/connectHelper";
points="7 4 13 10 7 16"></polyline></svg>
</span></a>-->
</cookie-law>
<!--<cookie-law *ngIf="isClient" position="top" cookieName="logActions-NOAMIreland">
National Open Access Monitor - Ireland, creates public logs for user actions.<br>
By using the National Open Access Monitor - Ireland portal you consent to log your actions <a
routerLink="/public-logs"> View Public logs <span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-right"
ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03"
points="7 4 13 10 7 16"></polyline></svg>
</span></a>
</cookie-law>-->
<footer class="uk-text-center uk-text-small uk-border-top">
<div class="uk-tile-default">
<div class="uk-section uk-container">
@ -67,26 +58,32 @@ import {ConnectHelper} from "./openaireLibrary/connect/connectHelper";
Developed by <a href="https://www.openaire.eu/" target="_blank">OpenAIRE</a>
</div>
<div class="uk-margin-bottom uk-container uk-container-small">
The National Open Access Monitor, Ireland is delivered as part of the National Open Access Monitor Project,
managed by the <a href="https://irel.ie/" target="_blank">Irish Research eLibrary (IReL)</a> at Maynooth University.
The project has received funding from Ireland's <a href="https://dri.ie/norf/" target="_blank">National Open Research Forum (NORF)</a>
The National Open Access Monitor, Ireland is delivered as part of the National Open Access Monitor
Project,
managed by the <a href="https://irel.ie/" target="_blank">Irish Research eLibrary (IReL)</a> at
Maynooth University.
The project has received funding from Ireland's <a href="https://dri.ie/norf/" target="_blank">National
Open Research Forum (NORF)</a>
under the Open Research Fund Call.
</div>
<div class="uk-margin-bottom">
<img title="Rialtas" src="assets/Rialtas_Mark_Std_Colour.png" class=" uk-padding-xsmall uk-padding-remove-vertical" style="height: 50px;">
<img title="HEA" src="assets/hea-logo.png" class=" uk-padding-xsmall uk-padding-remove-vertical" style="height: 30px;">
<img title="Maynooth University" src="assets/Maynooth University Logo.png" class=" uk-padding-small uk-padding-remove-vertical" style="height: 30px;">
<img title="IRel" src="assets/IReL logo.png" class=" uk-padding-small uk-padding-remove-vertical" style="height: 30px;">
<img title="NORF" src="assets/norf.jpg" class=" uk-padding-small uk-padding-remove-vertical" style="height: 30px;">
<img title="OpenAIRE" src="assets/common-assets/common/Logo_Horizontal.png" class=" uk-padding-small uk-padding-remove-vertical" style="height: 30px;">
<img title="Rialtas" src="assets/Rialtas_Mark_Std_Colour.png"
class=" uk-padding-xsmall uk-padding-remove-vertical" style="height: 50px;">
<img title="HEA" src="assets/hea-logo.png" class=" uk-padding-xsmall uk-padding-remove-vertical"
style="height: 30px;">
<img title="Maynooth University" src="assets/Maynooth University Logo.png"
class=" uk-padding-small uk-padding-remove-vertical" style="height: 30px;">
<img title="IRel" src="assets/IReL logo.png" class=" uk-padding-small uk-padding-remove-vertical"
style="height: 30px;">
<img title="OpenAIRE" src="assets/common-assets/common/Logo_Horizontal.png"
class=" uk-padding-small uk-padding-remove-vertical" style="height: 30px;">
</div>
</div>
</div>
</footer>
`
})
export class AppComponent extends ResearcherBaseComponent implements OnInit {
export class AppComponent extends ResearcherBaseComponent implements OnInit, AfterViewInit {
loading: boolean = false;
hasHeader: boolean = true;
rootClass: string;
@ -113,7 +110,7 @@ export class AppComponent extends ResearcherBaseComponent implements OnInit {
private configurationService: ConfigurationService,
private customFilterService: CustomFilterService,
private userManagementService: UserManagementService,
private userProfileService:UserProfileService,
private userProfileService: UserProfileService,
protected _searchOrcidService: SearchOrcidService,
protected _searchResearchResultsService: SearchResearchResultsService
) {
@ -135,7 +132,7 @@ export class AppComponent extends ResearcherBaseComponent implements OnInit {
ngOnInit() {
this.isClient = typeof document !== 'undefined';
if(this.properties.environment == 'beta') {
if (this.properties.environment == 'beta') {
this.header.environmentBadge = {
asset: 'assets/badge/sandbox.svg'
}
@ -147,18 +144,23 @@ export class AppComponent extends ResearcherBaseComponent implements OnInit {
}
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
this.user = user;
if(user){
if (user) {
this.userProfileService.initUserProfile()
}else{
} else {
this.userProfileService.setUserProfile(null);
}
this.initialize();
}));
}
ngAfterViewInit() {
this.subscriptions.push(this.layoutService.rootClass.subscribe(rootClass => {
if(rootClass && this.isClient) {
this.loading = true;
this.cdr.detectChanges();
if (rootClass && this.isClient) {
let link = <HTMLLinkElement>document.getElementById('theme');
let append = false;
if(!link) {
if (!link) {
link = document.createElement('link');
link.rel = 'stylesheet';
link.id = 'theme';
@ -166,14 +168,17 @@ export class AppComponent extends ResearcherBaseComponent implements OnInit {
}
link.href = rootClass + '.css';
link.onerror = (error) => console.log(error);
if(append) {
if (append) {
document.head.appendChild(link);
}
}
this.rootClass = rootClass;
this.cdr.detectChanges();
setTimeout(() => {
this.loading = false;
this.cdr.detectChanges();
}, 500)
}));
}
initialize() {
@ -184,9 +189,9 @@ export class AppComponent extends ResearcherBaseComponent implements OnInit {
new MenuItem("researcher", "Researcher Monitors", "", "/researcher", false, [], null, {}, null, null, null, "/researcher"),
new MenuItem("repository", "Repository Monitors", "", "/repository", false, [], null, {}, null, null, null, "/repository")
];
if(this.properties.environment != "beta"){
if (this.properties.environment != "beta") {
this.menuItems.push(
new MenuItem("resources", "Resources & Help", "", "", false, [], null, {}, null, null, null, "/resources","_blank", "internal", false,
new MenuItem("resources", "Resources & Help", "", "", false, [], null, {}, null, null, null, "/resources", "_blank", "internal", false,
[
new MenuItem("how-it-works", "How it works?", "", "", false, [], null, {}, null, null, null, null, "_self"),
new MenuItem("about", "About", "", "/how-it-works/about", false, [], null, {}, null, null, null, "/how-it-works/about"),
@ -205,15 +210,14 @@ export class AppComponent extends ResearcherBaseComponent implements OnInit {
}
if (this.user) {
this.userMenuItems = [];
// this.user.orcid = '0000-0003-4768-182X';
if(this.user.orcid) {
if (this.user.orcid) {
this.authorId = Identifier.getRawORCID(this.user.orcid);
this.results = {
success: (res: string | number) => {
if(+res > 0) {
if (+res > 0) {
this.userMenuItems.push(new MenuItem("my-researcher", "My Researcher Monitor", "", "/researcher/" + this.authorId, false, [], null, {}, null, null, null, null));
this.staticUserItems();
}else{
} else {
this.staticUserItems();
}
}
@ -236,10 +240,10 @@ export class AppComponent extends ResearcherBaseComponent implements OnInit {
this.userMenuItems.push(new MenuItem("stakeholders", "Manage profiles", "", "/admin", false, [], [], {}, {name: 'settings'}));
}
if (Session.isPortalAdministrator(this.user)) {
this.userMenuItems.push(new MenuItem("adminOptions", "Super Admin options", "", "/admin/admin-tools/portals", false, [], [], {},null, null, "uk-visible@m"));
this.userMenuItems.push(new MenuItem("adminOptions", "Super Admin options", "", "/admin/admin-tools/portals", false, [], [], {}, null, null, "uk-visible@m"));
}
if(Session.isPortalAdministrator(this.user) || Session.isCurator('country', this.user)) {
this.userMenuItems.push(new MenuItem("irishOptions", "Irish options", "", "/admin/irish/admin-tools/pages", false, [], [], {},null, null, "uk-visible@m"));
if (Session.isPortalAdministrator(this.user) || Session.isCurator('country', this.user)) {
this.userMenuItems.push(new MenuItem("irishOptions", "Irish options", "", "/admin/irish/admin-tools/pages", false, [], [], {}, null, null, "uk-visible@m"));
}
}