mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 02:24:11 +00:00
implemented edit popups and added actions
This commit is contained in:
@@ -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',
|
||||
|
@@ -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],
|
||||
|
@@ -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],
|
||||
|
@@ -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' },
|
||||
|
@@ -1,6 +0,0 @@
|
||||
<div>
|
||||
<div class="modal-header">New Collection</div>
|
||||
<div class="modal-body">
|
||||
<ds-dso-selector [currentDSOId]="communityRD?.payload.uuid"></ds-dso-selector>
|
||||
</div>
|
||||
</div>
|
@@ -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<Community>;
|
||||
|
||||
constructor(private route: ActivatedRoute) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.communityRD = this.route.root.firstChild.firstChild.snapshot.data.community;
|
||||
}
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
<div>
|
||||
<div class="modal-header">New Community</div>
|
||||
<div class="modal-body">
|
||||
<input/>
|
||||
<ds-currentDSOId-selector [currentDSOId]="communityRD?.payload.uuid"></ds-currentDSOId-selector>
|
||||
</div>
|
||||
</div>
|
@@ -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<Community>;
|
||||
|
||||
constructor(private route: ActivatedRoute) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.communityRD = this.route.root.firstChild.firstChild.snapshot.data.community;
|
||||
}
|
||||
}
|
@@ -5,8 +5,6 @@
|
||||
placeholder="{{ 'submission.sections.general.search-collection' | translate }}"
|
||||
[formControl]="input">
|
||||
</div>
|
||||
|
||||
{{input.value}}
|
||||
<div class="dropdown-divider"></div>
|
||||
<div class="scrollable-menu">
|
||||
<button class="dropdown-item disabled" *ngIf="(listEntries$ | async)?.length == 0">
|
||||
@@ -15,7 +13,7 @@
|
||||
<button *ngFor="let listEntry of (listEntries$ | async)"
|
||||
class="dropdown-item collection-item"
|
||||
title="{{ listEntry.dso.name }}"
|
||||
(click)="onSelect(listEntry.dso)">
|
||||
(click)="onSelect.emit(listEntry.dso)">
|
||||
<ul class="list-unstyled mb-0">
|
||||
<li class="list-item text-truncate text-secondary"
|
||||
*ngFor="let parent of listEntry.parents">
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { AfterViewInit, Component, Input, OnInit } from '@angular/core';
|
||||
import { AfterViewInit, Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { FormControl } from '@angular/forms';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { map, switchMap } from 'rxjs/operators';
|
||||
import { first, map, switchMap } from 'rxjs/operators';
|
||||
import { SearchService } from '../../../+search-page/search-service/search.service';
|
||||
import { PaginatedSearchOptions } from '../../../+search-page/paginated-search-options.model';
|
||||
import { DSpaceObjectType } from '../../../core/shared/dspace-object-type.model';
|
||||
@@ -10,6 +10,8 @@ import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { PaginatedList } from '../../../core/data/paginated-list';
|
||||
import { SearchResult } from '../../../+search-page/search-result.model';
|
||||
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
||||
import { Router } from '@angular/router';
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
|
||||
interface DSOSelectListEntry {
|
||||
parents: DSpaceObject[],
|
||||
@@ -25,12 +27,14 @@ export class DSOSelectorComponent implements OnInit, AfterViewInit {
|
||||
@Input() currentDSOId: string;
|
||||
@Input() type: DSpaceObjectType;
|
||||
|
||||
@Output() onSelect: EventEmitter<DSpaceObject> = new EventEmitter();
|
||||
|
||||
public input: FormControl = new FormControl();
|
||||
// private subs: Subscription[] = [];
|
||||
private defaultPagination = { id: 'dso-selector', currentPage: 1, pageSize: 5 } as any;
|
||||
listEntries$: Observable<DSOSelectListEntry[]>;
|
||||
|
||||
constructor(private searchService: SearchService) {
|
||||
constructor(private searchService: SearchService, private modalService: NgbModal) {
|
||||
|
||||
}
|
||||
|
||||
@@ -59,12 +63,23 @@ export class DSOSelectorComponent implements OnInit, AfterViewInit {
|
||||
)
|
||||
})
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
this.listEntries$
|
||||
.pipe(first())
|
||||
.subscribe((entries) => {
|
||||
if (entries.length === 1) {
|
||||
// SELECT ENTRY
|
||||
console.log(entries);
|
||||
}
|
||||
});
|
||||
|
||||
this.input.setValue(this.currentDSOId);
|
||||
}
|
||||
|
||||
retrieveParentList(dso: DSpaceObject, parents: DSpaceObject[] = []) {
|
||||
return [{name: 'Test Community'} as any];
|
||||
return [{ name: 'Test Community' } as any];
|
||||
// if (hasValue(dso.owner)) {
|
||||
// dso.owner.pipe(
|
||||
// first(),
|
||||
@@ -80,15 +95,8 @@ export class DSOSelectorComponent implements OnInit, AfterViewInit {
|
||||
// this.subs.filter((sub) => hasValue(sub)).forEach((sub) => sub.unsubscribe());
|
||||
// }
|
||||
|
||||
onSelect(event) {
|
||||
|
||||
}
|
||||
|
||||
onClose() {
|
||||
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
this.input.setValue(this.currentDSOId);
|
||||
// this.modalService.dismissAll();
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +0,0 @@
|
||||
<div>
|
||||
<div class="modal-header">New Item</div>
|
||||
<div class="modal-body">
|
||||
<ds-dso-selector [currentDSOId]="collectionRD?.payload.uuid"></ds-dso-selector>
|
||||
</div>
|
||||
</div>
|
@@ -1,21 +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';
|
||||
import { Collection } from '../../../core/shared/collection.model';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-item-selector-modal-wrapper',
|
||||
// styleUrls: ['./item-selector.component.scss'],
|
||||
templateUrl: './item-selector-modal-wrapper.component.html',
|
||||
})
|
||||
export class ItemSelectorModalWrapperComponent implements OnInit {
|
||||
@Input() collectionRD: RemoteData<Collection>;
|
||||
|
||||
constructor(private route: ActivatedRoute) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.collectionRD = this.route.root.firstChild.firstChild.snapshot.data.collection;
|
||||
}
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
<div>
|
||||
<div class="modal-header">New Collection</div>
|
||||
<div class="modal-body">
|
||||
<ds-dso-selector [currentDSOId]="(communityRD$ | async)?.payload.uuid" [type]="type" (onSelect)="createCollection($event)"></ds-dso-selector>
|
||||
</div>
|
||||
</div>
|
@@ -0,0 +1,39 @@
|
||||
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 { map } from 'rxjs/operators';
|
||||
import { Observable } from 'rxjs';
|
||||
import { COLLECTION_PARENT_PARAMETER } from '../../../../+collection-page/collection-page-routing.module';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-create-collection-parent-selector',
|
||||
// styleUrls: ['./create-collection-parent-selector.component.scss'],
|
||||
templateUrl: './create-collection-parent-selector.component.html',
|
||||
})
|
||||
export class CreateCollectionParentSelectorComponent implements OnInit {
|
||||
@Input() communityRD$: Observable<RemoteData<Community>>;
|
||||
type = DSpaceObjectType.COMMUNITY;
|
||||
|
||||
private createPath = '/collections/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));
|
||||
}
|
||||
|
||||
createCollection(dso: DSpaceObject) {
|
||||
this.activeModal.close();
|
||||
let navigationExtras: NavigationExtras = {
|
||||
queryParams: {
|
||||
[COLLECTION_PARENT_PARAMETER]: dso.uuid,
|
||||
}
|
||||
};
|
||||
this.router.navigate([this.createPath], navigationExtras);
|
||||
}
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
<div>
|
||||
<div class="modal-header">New Community</div>
|
||||
<div class="modal-body">
|
||||
<button class="form-control" (click)="createCommunity()">Create a new top-level community</button>
|
||||
<ds-dso-selector [currentDSOId]="(communityRD$ | async)?.payload.uuid" [type]="type" (onSelect)="createCommunity($event)"></ds-dso-selector>
|
||||
</div>
|
||||
</div>
|
@@ -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<RemoteData<Community>>;
|
||||
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);
|
||||
}
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
<div>
|
||||
<div class="modal-header">New Item</div>
|
||||
<div class="modal-body">
|
||||
<ds-dso-selector [currentDSOId]="(collectionRD$ | async)?.payload.uuid" [type]="type"></ds-dso-selector>
|
||||
</div>
|
||||
</div>
|
@@ -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<RemoteData<Collection>>;
|
||||
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]);
|
||||
}
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
<div>
|
||||
<div class="modal-header">Edit Collection</div>
|
||||
<div class="modal-body">
|
||||
<ds-dso-selector [currentDSOId]="(collectionRD$ | async)?.payload.uuid" [type]="type" (onSelect)="editCollection($event)"></ds-dso-selector>
|
||||
</div>
|
||||
</div>
|
@@ -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<RemoteData<Collection>>;
|
||||
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)]);
|
||||
}
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
<div>
|
||||
<div class="modal-header">Edit Community</div>
|
||||
<div class="modal-body">
|
||||
<ds-dso-selector [currentDSOId]="(communityRD$ | async)?.payload.uuid" [type]="type" (onSelect)="editCommunity($event)"></ds-dso-selector>
|
||||
</div>
|
||||
</div>
|
@@ -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<RemoteData<Community>>;
|
||||
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)]);
|
||||
}
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
<div>
|
||||
<div class="modal-header">Edit Item</div>
|
||||
<div class="modal-body">
|
||||
<ds-dso-selector [currentDSOId]="(itemRD$ | async)?.payload.uuid" [type]="type" (onSelect)="editItem($event)"></ds-dso-selector>
|
||||
</div>
|
||||
</div>
|
@@ -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<RemoteData<Item>>;
|
||||
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)]);
|
||||
}
|
||||
}
|
@@ -1 +1 @@
|
||||
<a class="nav-item nav-link" (click)="item.function()">{{item.text | translate}}</a>
|
||||
<a class="nav-item nav-link" role="button" (click)="item.function()">{{item.text | translate}}</a>
|
@@ -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 = [
|
||||
|
Reference in New Issue
Block a user