diff --git a/resources/i18n/en.json b/resources/i18n/en.json index 019a0b5eda..bc028c5554 100644 --- a/resources/i18n/en.json +++ b/resources/i18n/en.json @@ -213,71 +213,37 @@ }, "sidebar": { "section": { - "new": { - "header": "New", - "subsections": { - "community": "Community", - "collection": "Collection", - "item": "Item", - "item_version": "Item Version" - } - }, - "edit": { - "header": "Edit", - "subsections": { - "community": "Community", - "collection": "Collection", - "item": "Item" - } - }, - "import": { - "header": "Import", - "subsections": { - "metadata": "Metadata", - "batch_import": "Batch Import (ZIP)" - } - }, - "export": { - "header": "Export", - "subsections": { - "community": "Community", - "collection": "Collection", - "item": "Item", - "metadata": "Metadata" - } - }, - "access_control": { - "header": "Access Control", - "subsections": { - "people": "People", - "groups": "Groups", - "authorizations": "Authorizations" - } - }, - "find": { - "header": "Find", - "subsections": { - "items": "Items", - "withdrawn_items": "Withdrawn Items", - "private_items": "Private Items" - } - }, - "registries": { - "header": "Registries", - "subsections": { - "metadata": "Metadata", - "format": "Format" - } - }, - "curation_task": { - "header": "Curation Task" - }, - "statistics": { - "header": "Statistics Task" - }, - "control_panel": { - "header": "Control Panel" - } + "new": "New", + "new_community": "Community", + "new_collection": "Collection", + "new_item": "Item", + "new_item_version": "Item Version", + "edit": "Edit", + "edit_community": "Community", + "edit_collection": "Collection", + "edit_item": "Item", + "import": "Import", + "import_metadata": "Metadata", + "import_batch": "Batch Import (ZIP)", + "export": "Export", + "export_community": "Community", + "export_collection": "Collection", + "export_item": "Item", + "export_metadata": "Metadata", + "access_control": "Access Control", + "access_control_people": "People", + "access_control_groups": "Groups", + "access_control_authorizations": "Authorizations", + "find": "Find", + "find_items": "Items", + "find_withdrawn_items": "Withdrawn Items", + "find_private_items": "Private Items", + "registries": "Registries", + "registries_metadata": "Metadata", + "registries_format": "Format", + "curation_task": "Curation Task", + "statistics": "Statistics Task", + "control_panel": "Control Panel" } } }, diff --git a/src/app/+admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.html b/src/app/+admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.html index 66ed0d7cfb..7e5517fc76 100644 --- a/src/app/+admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.html +++ b/src/app/+admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.html @@ -1,10 +1,11 @@ \ No newline at end of file diff --git a/src/app/+admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.ts b/src/app/+admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.ts index 758ea72965..d4b37c6677 100644 --- a/src/app/+admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.ts +++ b/src/app/+admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.ts @@ -1,4 +1,8 @@ -import { Component, Input } from '@angular/core'; +import { Component, Inject, Injector, Input, OnInit } from '@angular/core'; +import { MenuSectionComponent } from '../../../shared/menu/menu-section/menu-section.component'; +import { MenuID } from '../../../shared/menu/initial-menus-state'; +import { rendersSectionForMenu } from '../../../shared/menu/menu.decorator'; +import { MenuService } from '../../../shared/menu/menu.service'; @Component({ selector: 'ds-admin-sidebar-section', @@ -6,8 +10,15 @@ import { Component, Input } from '@angular/core'; styleUrls: ['./admin-sidebar-section.component.scss'], }) -export class AdminSidebarSectionComponent { - @Input() name: string; - @Input() link: string; - @Input() icon: string; +@rendersSectionForMenu(MenuID.ADMIN, false) +export class AdminSidebarSectionComponent extends MenuSectionComponent implements OnInit { + menuID: MenuID = MenuID.ADMIN; + + constructor(@Inject('sectionDataProvider') menuSection, protected menuService: MenuService, protected injector: Injector,) { + super(menuSection, menuService, injector); + } + + ngOnInit(): void { + super.ngOnInit(); + } } diff --git a/src/app/+admin/admin-sidebar/admin-sidebar.actions.ts b/src/app/+admin/admin-sidebar/admin-sidebar.actions.ts deleted file mode 100644 index 323f6879c4..0000000000 --- a/src/app/+admin/admin-sidebar/admin-sidebar.actions.ts +++ /dev/null @@ -1,98 +0,0 @@ -import { Action } from '@ngrx/store'; - -import { type } from '../../shared/ngrx/type'; - -/** - * For each action type in an action group, make a simple - * enum object for all of this group's action types. - * - * The 'type' utility function coerces strings into string - * literal types and runs a simple check to guarantee all - * action types in the application are unique. - */ -export const AdminSidebarActionTypes = { - SECTION_COLLAPSE: type('dspace/admin-sidebar/SECTION_COLLAPSE'), - SECTION_COLLAPSE_ALL: type('dspace/admin-sidebar/SECTION_COLLAPSE_ALL'), - SECTION_EXPAND: type('dspace/admin-sidebar/SECTION_EXPAND'), - SECTION_TOGGLE: type('dspace/admin-sidebar/SECTION_TOGGLE'), - COLLAPSE: type('dspace/admin-sidebar/COLLAPSE'), - EXPAND: type('dspace/admin-sidebar/EXPAND'), - TOGGLE: type('dspace/admin-sidebar/TOGGLE'), -}; - -/* tslint:disable:max-classes-per-file */ -export class AdminSidebarAction implements Action { - - /** - * Type of action that will be performed - */ - type; -} - -export class AdminSidebarSectionAction extends AdminSidebarAction { - /** - * Name of the section the action is performed on, used to identify the section - */ - sectionName: string; - - /** - * Initialize with the section's name - * @param {string} name of the section - */ - constructor(name: string) { - super(); - this.sectionName = name; - } -} - -/* tslint:disable:max-classes-per-file */ -/** - * Used to collapse the sidebar - */ -export class AdminSidebarCollapseAction extends AdminSidebarAction { - type = AdminSidebarActionTypes.COLLAPSE; -} - -/** - * Used to expand the sidebar - */ -export class AdminSidebarExpandAction extends AdminSidebarAction { - type = AdminSidebarActionTypes.EXPAND; -} - -/** - * Used to collapse the sidebar when it's expanded and expand it when it's collapsed - */ -export class AdminSidebarToggleAction extends AdminSidebarAction { - type = AdminSidebarActionTypes.TOGGLE; -} - -/** - * Used to collapse a section - */ -export class AdminSidebarSectionCollapseAction extends AdminSidebarSectionAction { - type = AdminSidebarActionTypes.SECTION_COLLAPSE; -} - -/** - * Used to collapse a section - */ -export class AdminSidebarSectionCollapseAllAction extends AdminSidebarAction { - type = AdminSidebarActionTypes.SECTION_COLLAPSE_ALL; -} - -/** - * Used to expand a section - */ -export class AdminSidebarSectionExpandAction extends AdminSidebarSectionAction { - type = AdminSidebarActionTypes.SECTION_EXPAND; -} - -/** - * Used to collapse a section when it's expanded and expand it when it's collapsed - */ -export class AdminSidebarSectionToggleAction extends AdminSidebarSectionAction { - type = AdminSidebarActionTypes.SECTION_TOGGLE; -} - -/* tslint:enable:max-classes-per-file */ diff --git a/src/app/+admin/admin-sidebar/admin-sidebar.component.html b/src/app/+admin/admin-sidebar/admin-sidebar.component.html index 86d84b6707..633b4c63be 100644 --- a/src/app/+admin/admin-sidebar/admin-sidebar.component.html +++ b/src/app/+admin/admin-sidebar/admin-sidebar.component.html @@ -1,7 +1,7 @@