diff --git a/src/app/+admin/admin-sidebar/admin-sidebar.component.ts b/src/app/+admin/admin-sidebar/admin-sidebar.component.ts index 22cb1f5825..8b71bca423 100644 --- a/src/app/+admin/admin-sidebar/admin-sidebar.component.ts +++ b/src/app/+admin/admin-sidebar/admin-sidebar.component.ts @@ -12,9 +12,12 @@ import { first, map } from 'rxjs/operators'; import { combineLatest as combineLatestObservable } from 'rxjs'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { OnClickMenuItemModel } from '../../shared/menu/menu-item/models/onclick.model'; -import { CollectionSelectorModalWrapperComponent } from '../../shared/dso-selector/collection-selector-modal-wrapper/collection-selector-modal-wrapper.component'; -import { ItemSelectorModalWrapperComponent } from '../../shared/dso-selector/item-selector-modal-wrapper/item-selector-modal-wrapper.component'; -import { CommunitySelectorModalWrapperComponent } from '../../shared/dso-selector/community-selector-modal-wrapper/community-selector-modal-wrapper.component'; +import { CreateCommunityParentSelectorComponent } from '../../shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component'; +import { CreateItemParentSelectorComponent } from '../../shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component'; +import { CreateCollectionParentSelectorComponent } from '../../shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component'; +import { EditCollectionParentSelectorComponent } from '../../shared/dso-selector/modal-wrappers/edit-collection-parent-selector/edit-collection-parent-selector.component'; +import { EditItemParentSelectorComponent } from '../../shared/dso-selector/modal-wrappers/edit-item-parent-selector/edit-item-parent-selector.component'; +import { EditCommunityParentSelectorComponent } from '../../shared/dso-selector/modal-wrappers/edit-community-parent-selector/edit-community-parent-selector.component'; /** * Component representing the admin sidebar @@ -113,7 +116,7 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit { type: MenuItemType.ONCLICK, text: 'menu.section.new_community', function: () => { - this.modalService.open(CommunitySelectorModalWrapperComponent); + this.modalService.open(CreateCommunityParentSelectorComponent); } } as OnClickMenuItemModel, }, @@ -126,7 +129,7 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit { type: MenuItemType.ONCLICK, text: 'menu.section.new_collection', function: () => { - this.modalService.open(CollectionSelectorModalWrapperComponent); + this.modalService.open(CreateCollectionParentSelectorComponent); } } as OnClickMenuItemModel, }, @@ -139,7 +142,7 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit { type: MenuItemType.ONCLICK, text: 'menu.section.new_item', function: () => { - this.modalService.open(ItemSelectorModalWrapperComponent); + this.modalService.open(CreateItemParentSelectorComponent); } } as OnClickMenuItemModel, }, @@ -173,10 +176,12 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit { active: false, visible: true, model: { - type: MenuItemType.LINK, + type: MenuItemType.ONCLICK, text: 'menu.section.edit_community', - link: '#' - } as LinkMenuItemModel, + function: () => { + this.modalService.open(EditCommunityParentSelectorComponent); + } + } as OnClickMenuItemModel, }, { id: 'edit_collection', @@ -184,10 +189,12 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit { active: false, visible: true, model: { - type: MenuItemType.LINK, + type: MenuItemType.ONCLICK, text: 'menu.section.edit_collection', - link: '#' - } as LinkMenuItemModel, + function: () => { + this.modalService.open(EditCollectionParentSelectorComponent); + } + } as OnClickMenuItemModel, }, { id: 'edit_item', @@ -195,10 +202,12 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit { active: false, visible: true, model: { - type: MenuItemType.LINK, + type: MenuItemType.ONCLICK, text: 'menu.section.edit_item', - link: '#' - } as LinkMenuItemModel, + function: () => { + this.modalService.open(EditItemParentSelectorComponent); + } + } as OnClickMenuItemModel, }, /* Import */ @@ -235,7 +244,6 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit { link: '#' } as LinkMenuItemModel, }, - /* Export */ { id: 'export', diff --git a/src/app/+collection-page/collection-page-routing.module.ts b/src/app/+collection-page/collection-page-routing.module.ts index ddcf36a0cc..cdbd7650b2 100644 --- a/src/app/+collection-page/collection-page-routing.module.ts +++ b/src/app/+collection-page/collection-page-routing.module.ts @@ -8,17 +8,36 @@ import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; import { EditCollectionPageComponent } from './edit-collection-page/edit-collection-page.component'; import { CreateCollectionPageGuard } from './create-collection-page/create-collection-page.guard'; import { DeleteCollectionPageComponent } from './delete-collection-page/delete-collection-page.component'; +import { URLCombiner } from '../core/url-combiner/url-combiner'; +import { getCollectionModulePath } from '../app-routing.module'; + +export const COLLECTION_PARENT_PARAMETER = 'parent'; + +export function getCollectionPageRoute(collectionId: string) { + return new URLCombiner(getCollectionModulePath(), collectionId).toString(); +} + +export function getCollectionEditPath(id: string) { + return new URLCombiner(getCollectionModulePath(), COLLECTION_EDIT_PATH.replace(/:id/, id)).toString() +} + +export function getCollectionCreatePath() { + return new URLCombiner(getCollectionModulePath(), COLLECTION_CREATE_PATH).toString() +} + +const COLLECTION_CREATE_PATH = 'create'; +const COLLECTION_EDIT_PATH = ':id/edit'; @NgModule({ imports: [ RouterModule.forChild([ { - path: 'create', + path: COLLECTION_CREATE_PATH, component: CreateCollectionPageComponent, canActivate: [AuthenticatedGuard, CreateCollectionPageGuard] }, { - path: ':id/edit', + path: COLLECTION_EDIT_PATH, pathMatch: 'full', component: EditCollectionPageComponent, canActivate: [AuthenticatedGuard], diff --git a/src/app/+community-page/community-page-routing.module.ts b/src/app/+community-page/community-page-routing.module.ts index 02f28f6375..cecd17ec10 100644 --- a/src/app/+community-page/community-page-routing.module.ts +++ b/src/app/+community-page/community-page-routing.module.ts @@ -8,17 +8,36 @@ import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; import { EditCommunityPageComponent } from './edit-community-page/edit-community-page.component'; import { CreateCommunityPageGuard } from './create-community-page/create-community-page.guard'; import { DeleteCommunityPageComponent } from './delete-community-page/delete-community-page.component'; +import { URLCombiner } from '../core/url-combiner/url-combiner'; +import { getCommunityModulePath } from '../app-routing.module'; + +export const COMMUNITY_PARENT_PARAMETER = 'parent'; + +export function getCommunityPageRoute(communityId: string) { + return new URLCombiner(getCommunityModulePath(), communityId).toString(); +} + +export function getCommunityEditPath(id: string) { + return new URLCombiner(getCommunityModulePath(), COMMUNITY_EDIT_PATH.replace(/:id/, id)).toString() +} + +export function getCommunityCreatePath() { + return new URLCombiner(getCommunityModulePath(), COMMUNITY_CREATE_PATH).toString() +} + +const COMMUNITY_CREATE_PATH = 'create'; +const COMMUNITY_EDIT_PATH = ':id/edit'; @NgModule({ imports: [ RouterModule.forChild([ { - path: 'create', + path: COMMUNITY_CREATE_PATH, component: CreateCommunityPageComponent, canActivate: [AuthenticatedGuard, CreateCommunityPageGuard] }, { - path: ':id/edit', + path: COMMUNITY_EDIT_PATH, pathMatch: 'full', component: EditCommunityPageComponent, canActivate: [AuthenticatedGuard], diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 1476aa5dad..1448601067 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -8,13 +8,21 @@ const ITEM_MODULE_PATH = 'items'; export function getItemModulePath() { return `/${ITEM_MODULE_PATH}`; } +const COLLECTION_MODULE_PATH = 'collections'; +export function getCollectionModulePath() { + return `/${COLLECTION_MODULE_PATH}`; +} +const COMMUNITY_MODULE_PATH = 'communities'; +export function getCommunityModulePath() { + return `/${COMMUNITY_MODULE_PATH}`; +} @NgModule({ imports: [ RouterModule.forRoot([ { path: '', redirectTo: '/home', pathMatch: 'full' }, { path: 'home', loadChildren: './+home-page/home-page.module#HomePageModule' }, - { path: 'communities', loadChildren: './+community-page/community-page.module#CommunityPageModule' }, - { path: 'collections', loadChildren: './+collection-page/collection-page.module#CollectionPageModule' }, + { path: COMMUNITY_MODULE_PATH, loadChildren: './+community-page/community-page.module#CommunityPageModule' }, + { path: COLLECTION_MODULE_PATH, loadChildren: './+collection-page/collection-page.module#CollectionPageModule' }, { path: ITEM_MODULE_PATH, loadChildren: './+item-page/item-page.module#ItemPageModule' }, { path: 'search', loadChildren: './+search-page/search-page.module#SearchPageModule' }, { path: 'browse', loadChildren: './+browse-by/browse-by.module#BrowseByModule' }, diff --git a/src/app/shared/dso-selector/collection-selector-modal-wrapper/collection-selector-modal-wrapper.component.html b/src/app/shared/dso-selector/collection-selector-modal-wrapper/collection-selector-modal-wrapper.component.html deleted file mode 100644 index f3bf405651..0000000000 --- a/src/app/shared/dso-selector/collection-selector-modal-wrapper/collection-selector-modal-wrapper.component.html +++ /dev/null @@ -1,6 +0,0 @@ -
- - -
\ No newline at end of file diff --git a/src/app/shared/dso-selector/collection-selector-modal-wrapper/collection-selector-modal-wrapper.component.ts b/src/app/shared/dso-selector/collection-selector-modal-wrapper/collection-selector-modal-wrapper.component.ts deleted file mode 100644 index cda2284835..0000000000 --- a/src/app/shared/dso-selector/collection-selector-modal-wrapper/collection-selector-modal-wrapper.component.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Component, Input, OnInit } from '@angular/core'; -import { ActivatedRoute, Router } from '@angular/router'; -import { Community } from '../../../core/shared/community.model'; -import { RemoteData } from '../../../core/data/remote-data'; - -@Component({ - selector: 'ds-collection-selector-modal-wrapper', - // styleUrls: ['./collection-selector.component.scss'], - templateUrl: './collection-selector-modal-wrapper.component.html', -}) -export class CollectionSelectorModalWrapperComponent implements OnInit { - @Input() communityRD: RemoteData; - - constructor(private route: ActivatedRoute) { - } - - ngOnInit(): void { - this.communityRD = this.route.root.firstChild.firstChild.snapshot.data.community; - } -} diff --git a/src/app/shared/dso-selector/community-selector-modal-wrapper/community-selector-modal-wrapper.component.html b/src/app/shared/dso-selector/community-selector-modal-wrapper/community-selector-modal-wrapper.component.html deleted file mode 100644 index 91b97a25a3..0000000000 --- a/src/app/shared/dso-selector/community-selector-modal-wrapper/community-selector-modal-wrapper.component.html +++ /dev/null @@ -1,7 +0,0 @@ -
- - -
\ No newline at end of file diff --git a/src/app/shared/dso-selector/community-selector-modal-wrapper/community-selector-modal-wrapper.component.ts b/src/app/shared/dso-selector/community-selector-modal-wrapper/community-selector-modal-wrapper.component.ts deleted file mode 100644 index 8ebee7ea7f..0000000000 --- a/src/app/shared/dso-selector/community-selector-modal-wrapper/community-selector-modal-wrapper.component.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Component, Input, OnInit } from '@angular/core'; -import { ActivatedRoute, Router } from '@angular/router'; -import { Community } from '../../../core/shared/community.model'; -import { RemoteData } from '../../../core/data/remote-data'; - -@Component({ - selector: 'ds-community-selector-modal-wrapper', - // styleUrls: ['./community-selector.component.scss'], - templateUrl: './community-selector-modal-wrapper.component.html', -}) -export class CommunitySelectorModalWrapperComponent implements OnInit { - @Input() communityRD: RemoteData; - - constructor(private route: ActivatedRoute) { - } - - ngOnInit(): void { - this.communityRD = this.route.root.firstChild.firstChild.snapshot.data.community; - } -} diff --git a/src/app/shared/dso-selector/dso-selector/dso-selector.component.html b/src/app/shared/dso-selector/dso-selector/dso-selector.component.html index b15eaf9338..762f736b5d 100644 --- a/src/app/shared/dso-selector/dso-selector/dso-selector.component.html +++ b/src/app/shared/dso-selector/dso-selector/dso-selector.component.html @@ -5,8 +5,6 @@ placeholder="{{ 'submission.sections.general.search-collection' | translate }}" [formControl]="input"> - -{{input.value}}
+ +
+ \ No newline at end of file diff --git a/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.ts b/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.ts new file mode 100644 index 0000000000..8e1eb4e23f --- /dev/null +++ b/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.ts @@ -0,0 +1,43 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { ActivatedRoute, NavigationExtras, Router } from '@angular/router'; +import { Community } from '../../../../core/shared/community.model'; +import { RemoteData } from '../../../../core/data/remote-data'; +import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model'; +import { DSpaceObject } from '../../../../core/shared/dspace-object.model'; +import { hasValue } from '../../../empty.util'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { map } from 'rxjs/operators'; +import { Observable } from 'rxjs'; +import { COMMUNITY_PARENT_PARAMETER } from '../../../../+community-page/community-page-routing.module'; + +@Component({ + selector: 'ds-create-community-parent-selector', + // styleUrls: ['./create-community-parent-selector.component.scss'], + templateUrl: './create-community-parent-selector.component.html', +}) +export class CreateCommunityParentSelectorComponent implements OnInit { + @Input() communityRD$: Observable>; + type = DSpaceObjectType.COMMUNITY; + + private createPath = '/communities/create'; + + constructor(private activeModal: NgbActiveModal, private route: ActivatedRoute, private router: Router) { + } + + ngOnInit(): void { + this.communityRD$ = this.route.root.firstChild.firstChild.data.pipe(map(data => data.community)); + } + + createCommunity(dso?: DSpaceObject) { + this.activeModal.close(); + let navigationExtras: NavigationExtras = {}; + if (hasValue(dso)) { + navigationExtras = { + queryParams: { + [COMMUNITY_PARENT_PARAMETER]: dso.uuid, + } + }; + } + this.router.navigate([this.createPath], navigationExtras); + } +} diff --git a/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.html b/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.html new file mode 100644 index 0000000000..1851fb876b --- /dev/null +++ b/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.html @@ -0,0 +1,6 @@ +
+ + +
\ No newline at end of file diff --git a/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.ts b/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.ts new file mode 100644 index 0000000000..dba3db6959 --- /dev/null +++ b/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.ts @@ -0,0 +1,36 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { Community } from '../../../../core/shared/community.model'; +import { RemoteData } from '../../../../core/data/remote-data'; +import { Collection } from '../../../../core/shared/collection.model'; +import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model'; +import { DSpaceObject } from '../../../../core/shared/dspace-object.model'; +import { hasValue } from '../../../empty.util'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { map } from 'rxjs/operators'; +import { Observable } from 'rxjs'; + +@Component({ + selector: 'ds-create-item-parent-selector', + // styleUrls: ['./create-item-parent-selector.component.scss'], + templateUrl: './create-item-parent-selector.component.html', +}) +export class CreateItemParentSelectorComponent implements OnInit { + @Input() collectionRD$: Observable>; + type = DSpaceObjectType.COLLECTION; + + constructor(private activeModal: NgbActiveModal, private route: ActivatedRoute) { + } + + ngOnInit(): void { + this.collectionRD$ = this.route.root.firstChild.firstChild.data.pipe(map(data => data.collection)); + } + + createItem(dso: DSpaceObject) { + this.activeModal.close(); + + let path; + // path = this.createPath; + // this.router.navigate([path]); + } +} diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-collection-parent-selector/edit-collection-parent-selector.component.html b/src/app/shared/dso-selector/modal-wrappers/edit-collection-parent-selector/edit-collection-parent-selector.component.html new file mode 100644 index 0000000000..f14110db97 --- /dev/null +++ b/src/app/shared/dso-selector/modal-wrappers/edit-collection-parent-selector/edit-collection-parent-selector.component.html @@ -0,0 +1,6 @@ +
+ + +
\ No newline at end of file diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-collection-parent-selector/edit-collection-parent-selector.component.ts b/src/app/shared/dso-selector/modal-wrappers/edit-collection-parent-selector/edit-collection-parent-selector.component.ts new file mode 100644 index 0000000000..422bd8aee0 --- /dev/null +++ b/src/app/shared/dso-selector/modal-wrappers/edit-collection-parent-selector/edit-collection-parent-selector.component.ts @@ -0,0 +1,33 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { ActivatedRoute, NavigationExtras, Router } from '@angular/router'; +import { Community } from '../../../../core/shared/community.model'; +import { RemoteData } from '../../../../core/data/remote-data'; +import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model'; +import { DSpaceObject } from '../../../../core/shared/dspace-object.model'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { Collection } from '../../../../core/shared/collection.model'; +import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; +import { getCollectionEditPath } from '../../../../+collection-page/collection-page-routing.module'; + +@Component({ + selector: 'ds-edit-collection-parent-selector', + // styleUrls: ['./edit-collection-parent-selector.component.scss'], + templateUrl: './edit-collection-parent-selector.component.html', +}) +export class EditCollectionParentSelectorComponent implements OnInit { + @Input() collectionRD$: Observable>; + type = DSpaceObjectType.COLLECTION; + + constructor(private activeModal: NgbActiveModal, private route: ActivatedRoute, private router: Router) { + } + + ngOnInit(): void { + this.collectionRD$ = this.route.root.firstChild.firstChild.data.pipe(map(data => data.collection)); + } + + editCollection(dso: DSpaceObject) { + this.activeModal.close(); + this.router.navigate([getCollectionEditPath(dso.uuid)]); + } +} diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-community-parent-selector/edit-community-parent-selector.component.html b/src/app/shared/dso-selector/modal-wrappers/edit-community-parent-selector/edit-community-parent-selector.component.html new file mode 100644 index 0000000000..2cc8c8ae19 --- /dev/null +++ b/src/app/shared/dso-selector/modal-wrappers/edit-community-parent-selector/edit-community-parent-selector.component.html @@ -0,0 +1,6 @@ +
+ + +
\ No newline at end of file diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-community-parent-selector/edit-community-parent-selector.component.ts b/src/app/shared/dso-selector/modal-wrappers/edit-community-parent-selector/edit-community-parent-selector.component.ts new file mode 100644 index 0000000000..e14845bfa4 --- /dev/null +++ b/src/app/shared/dso-selector/modal-wrappers/edit-community-parent-selector/edit-community-parent-selector.component.ts @@ -0,0 +1,32 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { Community } from '../../../../core/shared/community.model'; +import { RemoteData } from '../../../../core/data/remote-data'; +import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model'; +import { DSpaceObject } from '../../../../core/shared/dspace-object.model'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; +import { getCommunityEditPath } from '../../../../+community-page/community-page-routing.module'; + +@Component({ + selector: 'ds-edit-community-parent-selector', + // styleUrls: ['./edit-community-parent-selector.component.scss'], + templateUrl: './edit-community-parent-selector.component.html', +}) +export class EditCommunityParentSelectorComponent implements OnInit { + @Input() communityRD$: Observable>; + type = DSpaceObjectType.COMMUNITY; + + constructor(private activeModal: NgbActiveModal, private route: ActivatedRoute, private router: Router) { + } + + ngOnInit(): void { + this.communityRD$ = this.route.root.firstChild.firstChild.data.pipe(map(data => data.collection)); + } + + editCommunity(dso: DSpaceObject) { + this.activeModal.close(); + this.router.navigate([getCommunityEditPath(dso.uuid)]); + } +} diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-item-parent-selector/edit-item-parent-selector.component.html b/src/app/shared/dso-selector/modal-wrappers/edit-item-parent-selector/edit-item-parent-selector.component.html new file mode 100644 index 0000000000..6bc59b96bd --- /dev/null +++ b/src/app/shared/dso-selector/modal-wrappers/edit-item-parent-selector/edit-item-parent-selector.component.html @@ -0,0 +1,6 @@ +
+ + +
\ No newline at end of file diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-item-parent-selector/edit-item-parent-selector.component.ts b/src/app/shared/dso-selector/modal-wrappers/edit-item-parent-selector/edit-item-parent-selector.component.ts new file mode 100644 index 0000000000..0a3963d6ae --- /dev/null +++ b/src/app/shared/dso-selector/modal-wrappers/edit-item-parent-selector/edit-item-parent-selector.component.ts @@ -0,0 +1,34 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { ActivatedRoute, NavigationExtras, Router } from '@angular/router'; +import { Community } from '../../../../core/shared/community.model'; +import { RemoteData } from '../../../../core/data/remote-data'; +import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model'; +import { DSpaceObject } from '../../../../core/shared/dspace-object.model'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { Collection } from '../../../../core/shared/collection.model'; +import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; +import { Item } from '../../../../core/shared/item.model'; +import { getItemEditPath } from '../../../../+item-page/item-page-routing.module'; + +@Component({ + selector: 'ds-edit-item-parent-selector', + // styleUrls: ['./edit-item-parent-selector.component.scss'], + templateUrl: './edit-item-parent-selector.component.html', +}) +export class EditItemParentSelectorComponent implements OnInit { + @Input() itemRD$: Observable>; + type = DSpaceObjectType.ITEM; + + constructor(private activeModal: NgbActiveModal, private route: ActivatedRoute, private router: Router) { + } + + ngOnInit(): void { + this.itemRD$ = this.route.root.firstChild.firstChild.data.pipe(map(data => data.item)); + } + + editItem(dso: DSpaceObject) { + this.activeModal.close(); + this.router.navigate([getItemEditPath(dso.uuid)]); + } +} diff --git a/src/app/shared/menu/menu-item/onclick-menu-item.component.html b/src/app/shared/menu/menu-item/onclick-menu-item.component.html index 0790ef7479..96c9049ab3 100644 --- a/src/app/shared/menu/menu-item/onclick-menu-item.component.html +++ b/src/app/shared/menu/menu-item/onclick-menu-item.component.html @@ -1 +1 @@ -{{item.text | translate}} \ No newline at end of file +{{item.text | translate}} \ No newline at end of file diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index 2d69c70591..3ee20d435d 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -91,14 +91,17 @@ import { CreateComColPageComponent } from './comcol-forms/create-comcol-page/cre import { EditComColPageComponent } from './comcol-forms/edit-comcol-page/edit-comcol-page.component'; import { DeleteComColPageComponent } from './comcol-forms/delete-comcol-page/delete-comcol-page.component'; import { LangSwitchComponent } from './lang-switch/lang-switch.component'; -import { CollectionSelectorModalWrapperComponent } from './dso-selector/collection-selector-modal-wrapper/collection-selector-modal-wrapper.component'; import { ObjectValuesPipe } from './utils/object-values-pipe'; import { InListValidator } from './utils/in-list-validator.directive'; import { AutoFocusDirective } from './utils/auto-focus.directive'; import { ComcolPageBrowseByComponent } from './comcol-page-browse-by/comcol-page-browse-by.component'; import { DSOSelectorComponent } from './dso-selector/dso-selector/dso-selector.component'; -import { ItemSelectorModalWrapperComponent } from './dso-selector/item-selector-modal-wrapper/item-selector-modal-wrapper.component'; -import { CommunitySelectorModalWrapperComponent } from './dso-selector/community-selector-modal-wrapper/community-selector-modal-wrapper.component'; +import { CreateCommunityParentSelectorComponent } from './dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component'; +import { CreateItemParentSelectorComponent } from './dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component'; +import { CreateCollectionParentSelectorComponent } from './dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component'; +import { EditCollectionParentSelectorComponent } from './dso-selector/modal-wrappers/edit-collection-parent-selector/edit-collection-parent-selector.component'; +import { EditItemParentSelectorComponent } from './dso-selector/modal-wrappers/edit-item-parent-selector/edit-item-parent-selector.component'; +import { EditCommunityParentSelectorComponent } from './dso-selector/modal-wrappers/edit-community-parent-selector/edit-community-parent-selector.component'; const MODULES = [ // Do NOT include UniversalModule, HttpModule, or JsonpModule here @@ -182,9 +185,12 @@ const COMPONENTS = [ BrowseByComponent, InputSuggestionsComponent, DSOSelectorComponent, - CommunitySelectorModalWrapperComponent, - CollectionSelectorModalWrapperComponent, - ItemSelectorModalWrapperComponent + CreateCommunityParentSelectorComponent, + CreateCollectionParentSelectorComponent, + CreateItemParentSelectorComponent, + EditCommunityParentSelectorComponent, + EditCollectionParentSelectorComponent, + EditItemParentSelectorComponent, ]; const ENTRY_COMPONENTS = [ @@ -199,9 +205,12 @@ const ENTRY_COMPONENTS = [ SearchResultGridElementComponent, BrowseEntryListElementComponent, DSOSelectorComponent, - CommunitySelectorModalWrapperComponent, - CollectionSelectorModalWrapperComponent, - ItemSelectorModalWrapperComponent + CreateCommunityParentSelectorComponent, + CreateCollectionParentSelectorComponent, + CreateItemParentSelectorComponent, + EditCommunityParentSelectorComponent, + EditCollectionParentSelectorComponent, + EditItemParentSelectorComponent, ]; const PROVIDERS = [