[develop]: Admin component: Add setAdminMenuItems method to replace duplicate code.
This commit is contained in:
parent
45a8cfc76a
commit
3f883248d2
|
@ -20,9 +20,11 @@ import {Irish} from "../shared/irish";
|
|||
[class.sidebar_main_active]="open && (hasSidebar || hasInternalSidebar || hasAdminMenu)"
|
||||
[class.sidebar_mini]="!open && (hasSidebar || hasInternalSidebar || hasAdminMenu)"
|
||||
[class.sidebar_hover]="hover">
|
||||
<dashboard-sidebar *ngIf="hasSidebar && !hasInternalSidebar && sideBarItems.length > 0" [logoURL]="stakeholder | logoUrl"
|
||||
<dashboard-sidebar *ngIf="hasSidebar && !hasInternalSidebar && sideBarItems.length > 0"
|
||||
[logoURL]="stakeholder | logoUrl"
|
||||
[items]="sideBarItems" [backItem]="backItem"></dashboard-sidebar>
|
||||
<dashboard-sidebar *ngIf="hasAdminMenu && !hasInternalSidebar" [items]="adminMenuItems" [backItem]="backItem"></dashboard-sidebar>
|
||||
<dashboard-sidebar *ngIf="hasAdminMenu && !hasInternalSidebar" [items]="adminMenuItems"
|
||||
[backItem]="backItem"></dashboard-sidebar>
|
||||
<div class="uk-width-1-1">
|
||||
<router-outlet></router-outlet>
|
||||
</div>
|
||||
|
@ -69,19 +71,10 @@ export class AdminComponent extends SidebarBaseComponent implements OnInit {
|
|||
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"));
|
||||
}
|
||||
this.backItem = null;
|
||||
if (this.hasAdminMenu) {
|
||||
this.adminMenuItems = [];
|
||||
this.backItem = null;
|
||||
this.adminMenuItems.push(new MenuItem("stakeholders", "Manage profiles", "", "/admin", false, [], [], {}, {name: 'settings'}));
|
||||
if (Session.isPortalAdministrator(this.user)) {
|
||||
this.adminMenuItems.push(new MenuItem("adminOptions", "Super Admin options", "", "/admin/admin-tools/portals", false, [], [], {}, {name: 'settings'}, null, "uk-visible@m", '/admin/admin-tools'));
|
||||
}
|
||||
if (Session.isPortalAdministrator(this.user) || Session.isMonitorCurator(this.user)) {
|
||||
this.adminMenuItems.push(new MenuItem("irishOptions", "Irish options", "", "/admin/irish/admin-tools/pages", false, [], [], {}, {name: 'settings'}, null, "uk-visible@m", '/admin/irish/admin-tools'));
|
||||
}
|
||||
this.hasAdminMenu = this.hasAdminMenu && this.adminMenuItems.length > 1;
|
||||
this.setAdminMenuItems();
|
||||
}
|
||||
|
||||
this.backItem = new MenuItem("back", "Manage profiles", "", "/admin", false, [], null, {}, {name: 'west'});
|
||||
this.loading = false;
|
||||
}));
|
||||
|
@ -92,16 +85,7 @@ export class AdminComponent extends SidebarBaseComponent implements OnInit {
|
|||
this.hasSidebar = false;
|
||||
this.loading = false;
|
||||
if (this.hasAdminMenu) {
|
||||
this.adminMenuItems = [];
|
||||
this.backItem = null;
|
||||
this.adminMenuItems.push(new MenuItem("stakeholders", "Manage profiles", "", "/admin", false, [], [], {}, {name: 'settings'}));
|
||||
if (Session.isPortalAdministrator(this.user)) {
|
||||
this.adminMenuItems.push(new MenuItem("adminOptions", "Super Admin options", "", "/admin/admin-tools/portals", false, [], [], {}, {name: 'settings'}, null, "uk-visible@m", '/admin/admin-tools'));
|
||||
}
|
||||
if (Session.isPortalAdministrator(this.user) || Session.isMonitorCurator(this.user)) {
|
||||
this.adminMenuItems.push(new MenuItem("irishOptions", "Irish options", "", "/admin/irish/admin-tools/pages", false, [], [], {}, {name: 'settings'}, null, "uk-visible@m", '/admin/irish/admin-tools'));
|
||||
}
|
||||
this.hasAdminMenu = this.hasAdminMenu && this.adminMenuItems.length > 1;
|
||||
this.setAdminMenuItems();
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
@ -125,6 +109,18 @@ export class AdminComponent extends SidebarBaseComponent implements OnInit {
|
|||
this.configurationService.initPortal(this.properties, this.properties.adminToolsCommunity);
|
||||
}
|
||||
|
||||
private setAdminMenuItems() {
|
||||
this.adminMenuItems = [];
|
||||
this.adminMenuItems.push(new MenuItem("stakeholders", "Manage profiles", "", "/admin", false, [], [], {}, {name: 'settings'}));
|
||||
if (Session.isPortalAdministrator(this.user)) {
|
||||
this.adminMenuItems.push(new MenuItem("adminOptions", "Super Admin options", "", "/admin/admin-tools/portals", false, [], [], {}, {name: 'settings'}, null, "uk-visible@m", '/admin/admin-tools'));
|
||||
}
|
||||
if (Session.isPortalAdministrator(this.user) || Session.isMonitorCurator(this.user)) {
|
||||
this.adminMenuItems.push(new MenuItem("irishOptions", "Irish options", "", "/admin/irish/admin-tools/pages", false, [], [], {}, {name: 'settings'}, null, "uk-visible@m", '/admin/irish/admin-tools'));
|
||||
}
|
||||
this.hasAdminMenu = this.hasAdminMenu && this.adminMenuItems.length > 1;
|
||||
}
|
||||
|
||||
public get isAdmin() {
|
||||
return Session.isPortalAdministrator(this.user) || Session.isCurator(this.stakeholder.type, this.user);
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 8f668cd4ff51655caacdab42304c32cb2446fe64
|
||||
Subproject commit c7628584277d8a81274ef40a58e908df988a5e58
|
Loading…
Reference in New Issue