diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index a135edfa2c..93c1b31092 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -98,8 +98,8 @@ import { ThemedPageErrorComponent } from './page-error/themed-page-error.compone }, { path: COMMUNITY_MODULE_PATH, - loadChildren: () => import('./community-page/community-page.module') - .then((m) => m.CommunityPageModule), + loadChildren: () => import('./community-page/community-page-routes') + .then((m) => m.ROUTES), canActivate: [EndUserAgreementCurrentUserGuard] }, { diff --git a/src/app/community-page/community-page-routes.ts b/src/app/community-page/community-page-routes.ts new file mode 100644 index 0000000000..1db374d71f --- /dev/null +++ b/src/app/community-page/community-page-routes.ts @@ -0,0 +1,83 @@ +import { Route } from '@angular/router'; + +import { CommunityPageResolver } from './community-page.resolver'; +import { CreateCommunityPageComponent } from './create-community-page/create-community-page.component'; +import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; +import { CreateCommunityPageGuard } from './create-community-page/create-community-page.guard'; +import { DeleteCommunityPageComponent } from './delete-community-page/delete-community-page.component'; +import { CommunityBreadcrumbResolver } from '../core/breadcrumbs/community-breadcrumb.resolver'; +import { DSOBreadcrumbsService } from '../core/breadcrumbs/dso-breadcrumbs.service'; +import { LinkService } from '../core/cache/builders/link.service'; +import { COMMUNITY_CREATE_PATH, COMMUNITY_EDIT_PATH } from './community-page-routing-paths'; +import { CommunityPageAdministratorGuard } from './community-page-administrator.guard'; +import { LinkMenuItemModel } from '../shared/menu/menu-item/models/link.model'; +import { ThemedCommunityPageComponent } from './themed-community-page.component'; +import { MenuItemType } from '../shared/menu/menu-item-type.model'; +import { DSOEditMenuResolver } from '../shared/dso-page/dso-edit-menu.resolver'; + +export const ROUTES: Route[] = [ + { + path: COMMUNITY_CREATE_PATH, + component: CreateCommunityPageComponent, + canActivate: [AuthenticatedGuard, CreateCommunityPageGuard], + providers: [ + CommunityPageResolver, + CommunityBreadcrumbResolver, + DSOBreadcrumbsService, + LinkService, + CreateCommunityPageGuard, + CommunityPageAdministratorGuard, + ] + }, + { + path: ':id', + resolve: { + dso: CommunityPageResolver, + breadcrumb: CommunityBreadcrumbResolver, + menu: DSOEditMenuResolver + }, + providers: [ + CommunityPageResolver, + CommunityBreadcrumbResolver, + DSOBreadcrumbsService, + LinkService, + CreateCommunityPageGuard, + CommunityPageAdministratorGuard, + ], + runGuardsAndResolvers: 'always', + children: [ + { + path: COMMUNITY_EDIT_PATH, + loadChildren: () => import('./edit-community-page/edit-community-page-routes') + .then((m) => m.ROUTES), + canActivate: [CommunityPageAdministratorGuard] + }, + { + path: 'delete', + pathMatch: 'full', + component: DeleteCommunityPageComponent, + canActivate: [AuthenticatedGuard], + }, + { + path: '', + component: ThemedCommunityPageComponent, + pathMatch: 'full', + } + ], + data: { + menu: { + public: [{ + id: 'statistics_community_:id', + active: true, + visible: true, + index: 2, + model: { + type: MenuItemType.LINK, + text: 'menu.section.statistics', + link: 'statistics/communities/:id/', + } as LinkMenuItemModel, + }], + }, + }, + }, +]; diff --git a/src/app/community-page/community-page-routing.module.ts b/src/app/community-page/community-page-routing.module.ts deleted file mode 100644 index c37f8832f8..0000000000 --- a/src/app/community-page/community-page-routing.module.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { NgModule } from '@angular/core'; -import { RouterModule } from '@angular/router'; - -import { CommunityPageResolver } from './community-page.resolver'; -import { CreateCommunityPageComponent } from './create-community-page/create-community-page.component'; -import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; -import { CreateCommunityPageGuard } from './create-community-page/create-community-page.guard'; -import { DeleteCommunityPageComponent } from './delete-community-page/delete-community-page.component'; -import { CommunityBreadcrumbResolver } from '../core/breadcrumbs/community-breadcrumb.resolver'; -import { DSOBreadcrumbsService } from '../core/breadcrumbs/dso-breadcrumbs.service'; -import { LinkService } from '../core/cache/builders/link.service'; -import { COMMUNITY_EDIT_PATH, COMMUNITY_CREATE_PATH } from './community-page-routing-paths'; -import { CommunityPageAdministratorGuard } from './community-page-administrator.guard'; -import { LinkMenuItemModel } from '../shared/menu/menu-item/models/link.model'; -import { ThemedCommunityPageComponent } from './themed-community-page.component'; -import { MenuItemType } from '../shared/menu/menu-item-type.model'; -import { DSOEditMenuResolver } from '../shared/dso-page/dso-edit-menu.resolver'; - -@NgModule({ - imports: [ - RouterModule.forChild([ - { - path: COMMUNITY_CREATE_PATH, - component: CreateCommunityPageComponent, - canActivate: [AuthenticatedGuard, CreateCommunityPageGuard] - }, - { - path: ':id', - resolve: { - dso: CommunityPageResolver, - breadcrumb: CommunityBreadcrumbResolver, - menu: DSOEditMenuResolver - }, - runGuardsAndResolvers: 'always', - children: [ - { - path: COMMUNITY_EDIT_PATH, - loadChildren: () => import('./edit-community-page/edit-community-page.module') - .then((m) => m.EditCommunityPageModule), - canActivate: [CommunityPageAdministratorGuard] - }, - { - path: 'delete', - pathMatch: 'full', - component: DeleteCommunityPageComponent, - canActivate: [AuthenticatedGuard], - }, - { - path: '', - component: ThemedCommunityPageComponent, - pathMatch: 'full', - } - ], - data: { - menu: { - public: [{ - id: 'statistics_community_:id', - active: true, - visible: true, - index: 2, - model: { - type: MenuItemType.LINK, - text: 'menu.section.statistics', - link: 'statistics/communities/:id/', - } as LinkMenuItemModel, - }], - }, - }, - }, - ]) - ], - providers: [ - CommunityPageResolver, - CommunityBreadcrumbResolver, - DSOBreadcrumbsService, - LinkService, - CreateCommunityPageGuard, - CommunityPageAdministratorGuard, - ] -}) -export class CommunityPageRoutingModule { - -} diff --git a/src/app/community-page/community-page.module.ts b/src/app/community-page/community-page.module.ts deleted file mode 100644 index 2acefe19bb..0000000000 --- a/src/app/community-page/community-page.module.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; - - -import { CommunityPageComponent } from './community-page.component'; -import { CommunityPageSubCollectionListComponent } from './sub-collection-list/community-page-sub-collection-list.component'; -import { CommunityPageRoutingModule } from './community-page-routing.module'; -import { CommunityPageSubCommunityListComponent } from './sub-community-list/community-page-sub-community-list.component'; -import { CreateCommunityPageComponent } from './create-community-page/create-community-page.component'; -import { DeleteCommunityPageComponent } from './delete-community-page/delete-community-page.component'; -import { StatisticsModule } from '../statistics/statistics.module'; -import { CommunityFormModule } from './community-form/community-form.module'; -import { ThemedCommunityPageComponent } from './themed-community-page.component'; -import { ComcolModule } from '../shared/comcol/comcol.module'; -import { - ThemedCommunityPageSubCommunityListComponent -} from './sub-community-list/themed-community-page-sub-community-list.component'; -import { - ThemedCollectionPageSubCollectionListComponent -} from './sub-collection-list/themed-community-page-sub-collection-list.component'; -import { DsoPageModule } from '../shared/dso-page/dso-page.module'; - -const DECLARATIONS = [CommunityPageComponent, - ThemedCommunityPageComponent, - ThemedCommunityPageSubCommunityListComponent, - CommunityPageSubCollectionListComponent, - ThemedCollectionPageSubCollectionListComponent, - CommunityPageSubCommunityListComponent, - CreateCommunityPageComponent, - DeleteCommunityPageComponent]; - -@NgModule({ - imports: [ - CommonModule, - CommunityPageRoutingModule, - StatisticsModule.forRoot(), - CommunityFormModule, - ComcolModule, - DsoPageModule, - ...DECLARATIONS - ], - exports: [ - ...DECLARATIONS - ] -}) - -export class CommunityPageModule { - -} diff --git a/src/app/community-page/edit-community-page/edit-community-page-routes.ts b/src/app/community-page/edit-community-page/edit-community-page-routes.ts new file mode 100644 index 0000000000..25fe8a5914 --- /dev/null +++ b/src/app/community-page/edit-community-page/edit-community-page-routes.ts @@ -0,0 +1,93 @@ +import { EditCommunityPageComponent } from './edit-community-page.component'; +import { Route } from '@angular/router'; +import { CommunityMetadataComponent } from './community-metadata/community-metadata.component'; +import { CommunityRolesComponent } from './community-roles/community-roles.component'; +import { CommunityCurateComponent } from './community-curate/community-curate.component'; +import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver'; +import { CommunityAuthorizationsComponent } from './community-authorizations/community-authorizations.component'; +import { ResourcePolicyTargetResolver } from '../../shared/resource-policies/resolvers/resource-policy-target.resolver'; +import { ResourcePolicyCreateComponent } from '../../shared/resource-policies/create/resource-policy-create.component'; +import { ResourcePolicyResolver } from '../../shared/resource-policies/resolvers/resource-policy.resolver'; +import { ResourcePolicyEditComponent } from '../../shared/resource-policies/edit/resource-policy-edit.component'; +import { + CommunityAdministratorGuard +} from '../../core/data/feature-authorization/feature-authorization-guard/community-administrator.guard'; +import { CommunityAccessControlComponent } from './community-access-control/community-access-control.component'; + +/** + * Routing module that handles the routing for the Edit Community page administrator functionality + */ + +export const ROUTES: Route[] = [ + { + path: '', + resolve: { + breadcrumb: I18nBreadcrumbResolver + }, + providers: [ + ResourcePolicyResolver, + ResourcePolicyTargetResolver + ], + data: { breadcrumbKey: 'community.edit' }, + component: EditCommunityPageComponent, + canActivate: [CommunityAdministratorGuard], + children: [ + { + path: '', + redirectTo: 'metadata', + pathMatch: 'full' + }, + { + path: 'metadata', + component: CommunityMetadataComponent, + data: { + title: 'community.edit.tabs.metadata.title', + hideReturnButton: true, + showBreadcrumbs: true + } + }, + { + path: 'roles', + component: CommunityRolesComponent, + data: { title: 'community.edit.tabs.roles.title', showBreadcrumbs: true } + }, + { + path: 'curate', + component: CommunityCurateComponent, + data: { title: 'community.edit.tabs.curate.title', showBreadcrumbs: true } + }, + { + path: 'access-control', + component: CommunityAccessControlComponent, + data: { title: 'collection.edit.tabs.access-control.title', showBreadcrumbs: true } + }, + { + path: 'authorizations', + data: { showBreadcrumbs: true }, + children: [ + { + path: 'create', + resolve: { + resourcePolicyTarget: ResourcePolicyTargetResolver + }, + component: ResourcePolicyCreateComponent, + data: { title: 'resource-policies.create.page.title' } + }, + { + path: 'edit', + resolve: { + resourcePolicy: ResourcePolicyResolver + }, + component: ResourcePolicyEditComponent, + data: { title: 'resource-policies.edit.page.title' } + }, + { + path: '', + component: CommunityAuthorizationsComponent, + data: { title: 'community.edit.tabs.authorizations.title', showBreadcrumbs: true, hideReturnButton: true } + } + ] + } + ] + } +]; diff --git a/src/app/community-page/edit-community-page/edit-community-page.module.ts b/src/app/community-page/edit-community-page/edit-community-page.module.ts deleted file mode 100644 index 8b2086494a..0000000000 --- a/src/app/community-page/edit-community-page/edit-community-page.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { EditCommunityPageRoutingModule } from './edit-community-page.routing.module'; -import { EditCommunityPageComponent } from './edit-community-page.component'; -import { CommunityCurateComponent } from './community-curate/community-curate.component'; -import { CommunityMetadataComponent } from './community-metadata/community-metadata.component'; -import { CommunityRolesComponent } from './community-roles/community-roles.component'; -import { CommunityAuthorizationsComponent } from './community-authorizations/community-authorizations.component'; -import { CommunityFormModule } from '../community-form/community-form.module'; -import { ResourcePoliciesModule } from '../../shared/resource-policies/resource-policies.module'; -import { ComcolModule } from '../../shared/comcol/comcol.module'; -import { CommunityAccessControlComponent } from './community-access-control/community-access-control.component'; -import { - AccessControlFormModule -} from '../../shared/access-control-form-container/access-control-form.module'; - -/** - * Module that contains all components related to the Edit Community page administrator functionality - */ -@NgModule({ - imports: [ - CommonModule, - EditCommunityPageRoutingModule, - CommunityFormModule, - ComcolModule, - ResourcePoliciesModule, - AccessControlFormModule, - EditCommunityPageComponent, - CommunityCurateComponent, - CommunityMetadataComponent, - CommunityRolesComponent, - CommunityAuthorizationsComponent, - CommunityAccessControlComponent - ] -}) -export class EditCommunityPageModule { - -} diff --git a/src/app/community-page/edit-community-page/edit-community-page.routing.module.ts b/src/app/community-page/edit-community-page/edit-community-page.routing.module.ts deleted file mode 100644 index 994c6b5e96..0000000000 --- a/src/app/community-page/edit-community-page/edit-community-page.routing.module.ts +++ /dev/null @@ -1,103 +0,0 @@ -import { EditCommunityPageComponent } from './edit-community-page.component'; -import { RouterModule } from '@angular/router'; -import { NgModule } from '@angular/core'; -import { CommunityMetadataComponent } from './community-metadata/community-metadata.component'; -import { CommunityRolesComponent } from './community-roles/community-roles.component'; -import { CommunityCurateComponent } from './community-curate/community-curate.component'; -import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver'; -import { CommunityAuthorizationsComponent } from './community-authorizations/community-authorizations.component'; -import { ResourcePolicyTargetResolver } from '../../shared/resource-policies/resolvers/resource-policy-target.resolver'; -import { ResourcePolicyCreateComponent } from '../../shared/resource-policies/create/resource-policy-create.component'; -import { ResourcePolicyResolver } from '../../shared/resource-policies/resolvers/resource-policy.resolver'; -import { ResourcePolicyEditComponent } from '../../shared/resource-policies/edit/resource-policy-edit.component'; -import { CommunityAdministratorGuard } from '../../core/data/feature-authorization/feature-authorization-guard/community-administrator.guard'; -import { CommunityAccessControlComponent } from './community-access-control/community-access-control.component'; - -/** - * Routing module that handles the routing for the Edit Community page administrator functionality - */ -@NgModule({ - imports: [ - RouterModule.forChild([ - { - path: '', - resolve: { - breadcrumb: I18nBreadcrumbResolver - }, - data: { breadcrumbKey: 'community.edit' }, - component: EditCommunityPageComponent, - canActivate: [CommunityAdministratorGuard], - children: [ - { - path: '', - redirectTo: 'metadata', - pathMatch: 'full' - }, - { - path: 'metadata', - component: CommunityMetadataComponent, - data: { - title: 'community.edit.tabs.metadata.title', - hideReturnButton: true, - showBreadcrumbs: true - } - }, - { - path: 'roles', - component: CommunityRolesComponent, - data: { title: 'community.edit.tabs.roles.title', showBreadcrumbs: true } - }, - { - path: 'curate', - component: CommunityCurateComponent, - data: { title: 'community.edit.tabs.curate.title', showBreadcrumbs: true } - }, - { - path: 'access-control', - component: CommunityAccessControlComponent, - data: { title: 'collection.edit.tabs.access-control.title', showBreadcrumbs: true } - }, - /*{ - path: 'authorizations', - component: CommunityAuthorizationsComponent, - data: { title: 'community.edit.tabs.authorizations.title', showBreadcrumbs: true } - },*/ - { - path: 'authorizations', - data: { showBreadcrumbs: true }, - children: [ - { - path: 'create', - resolve: { - resourcePolicyTarget: ResourcePolicyTargetResolver - }, - component: ResourcePolicyCreateComponent, - data: { title: 'resource-policies.create.page.title' } - }, - { - path: 'edit', - resolve: { - resourcePolicy: ResourcePolicyResolver - }, - component: ResourcePolicyEditComponent, - data: { title: 'resource-policies.edit.page.title' } - }, - { - path: '', - component: CommunityAuthorizationsComponent, - data: { title: 'community.edit.tabs.authorizations.title', showBreadcrumbs: true, hideReturnButton: true } - } - ] - } - ] - } - ]) - ], - providers: [ - ResourcePolicyResolver, - ResourcePolicyTargetResolver - ] -}) -export class EditCommunityPageRoutingModule { - -} diff --git a/src/themes/custom/lazy-theme.module.ts b/src/themes/custom/lazy-theme.module.ts index f54abcfb77..7b89d86d24 100644 --- a/src/themes/custom/lazy-theme.module.ts +++ b/src/themes/custom/lazy-theme.module.ts @@ -25,7 +25,6 @@ import { ItemPageModule } from '../../app/item-page/item-page.module'; import { RouterModule } from '@angular/router'; import { InfoModule } from '../../app/info/info.module'; import { StatisticsPageModule } from '../../app/statistics-page/statistics-page.module'; -import { CommunityPageModule } from '../../app/community-page/community-page.module'; import { CollectionPageModule } from '../../app/collection-page/collection-page.module'; import { SubmissionModule } from '../../app/submission/submission.module'; import { MyDSpacePageModule } from '../../app/my-dspace-page/my-dspace-page.module'; @@ -273,7 +272,6 @@ const DECLARATIONS = [ CollectionPageModule, CommonModule, CommunityFormModule, - CommunityPageModule, DragDropModule, ItemSharedModule, ItemPageModule, diff --git a/src/themes/dspace/lazy-theme.module.ts b/src/themes/dspace/lazy-theme.module.ts index 39df9e0d6c..222f7cdaf8 100644 --- a/src/themes/dspace/lazy-theme.module.ts +++ b/src/themes/dspace/lazy-theme.module.ts @@ -25,7 +25,6 @@ import { ItemPageModule } from '../../app/item-page/item-page.module'; import { RouterModule } from '@angular/router'; import { InfoModule } from '../../app/info/info.module'; import { StatisticsPageModule } from '../../app/statistics-page/statistics-page.module'; -import { CommunityPageModule } from '../../app/community-page/community-page.module'; import { CollectionPageModule } from '../../app/collection-page/collection-page.module'; import { SubmissionModule } from '../../app/submission/submission.module'; import { MyDSpacePageModule } from '../../app/my-dspace-page/my-dspace-page.module'; @@ -54,7 +53,6 @@ const DECLARATIONS = [ CollectionPageModule, CommonModule, CommunityFormModule, - CommunityPageModule, DragDropModule, ItemSharedModule, ItemPageModule,