submit to this collection

This commit is contained in:
Ben Bosman
2020-01-10 18:15:28 +01:00
parent feced9f893
commit 3a37f9be12
5 changed files with 21 additions and 23 deletions

View File

@@ -17,6 +17,7 @@ import { CreateCollectionParentSelectorComponent } from '../../shared/dso-select
import { EditItemSelectorComponent } from '../../shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component'; import { EditItemSelectorComponent } from '../../shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component';
import { EditCommunitySelectorComponent } from '../../shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component'; import { EditCommunitySelectorComponent } from '../../shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component';
import { EditCollectionSelectorComponent } from '../../shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component'; import { EditCollectionSelectorComponent } from '../../shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component';
import {CreateItemParentSelectorComponent} from '../../shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component';
/** /**
* Component representing the admin sidebar * Component representing the admin sidebar
@@ -137,18 +138,18 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
parentID: 'new', parentID: 'new',
active: false, active: false,
visible: true, visible: true,
// model: {
// type: MenuItemType.ONCLICK,
// text: 'menu.section.new_item',
// function: () => {
// this.modalService.open(CreateItemParentSelectorComponent);
// }
// } as OnClickMenuItemModel,
model: { model: {
type: MenuItemType.LINK, type: MenuItemType.ONCLICK,
text: 'menu.section.new_item', text: 'menu.section.new_item',
link: '/submit' function: () => {
} as LinkMenuItemModel, this.modalService.open(CreateItemParentSelectorComponent);
}
} as OnClickMenuItemModel,
// model: {
// type: MenuItemType.LINK,
// text: 'menu.section.new_item',
// link: '/submit'
// } as LinkMenuItemModel,
}, },
{ {
id: 'new_item_version', id: 'new_item_version',

View File

@@ -32,13 +32,6 @@
</ds-comcol-page-content> </ds-comcol-page-content>
</header> </header>
<div class="add">
<a class="btn btn-lg btn-primary mt-1 ml-2" [routerLink]="['/submit']" [queryParams]="{collection:collection.id}" role="button">
<i class="fa fa-plus-circle" aria-hidden="true"></i> {{'mydspace.new-submission' | translate}}
</a>
</div>
<section class="comcol-page-browse-section"> <section class="comcol-page-browse-section">
<!-- Browse-By Links --> <!-- Browse-By Links -->
<ds-comcol-page-browse-by <ds-comcol-page-browse-by

View File

@@ -72,7 +72,7 @@ export class SubmissionRestService {
protected getEndpointByIDHref(endpoint, resourceID, collectionId?: string): string { protected getEndpointByIDHref(endpoint, resourceID, collectionId?: string): string {
let url = isNotEmpty(resourceID) ? `${endpoint}/${resourceID}` : `${endpoint}`; let url = isNotEmpty(resourceID) ? `${endpoint}/${resourceID}` : `${endpoint}`;
if (collectionId) { if (collectionId) {
url = new URLCombiner(url, '?owningCollection=' + collectionId).toString(); url = new URLCombiner(url, `?owningCollection=${collectionId}`).toString();
} }
return url; return url;
} }

View File

@@ -59,9 +59,8 @@ describe('CreateItemParentSelectorComponent', () => {
}); });
it('should call navigate on the router with the correct create path when navigate is called', () => { it('should call navigate on the router with the correct create path when navigate is called', () => {
/* TODO when there is a specific submission path */ component.navigate(collection);
// component.navigate(item); expect(router.navigate).toHaveBeenCalledWith(['/submit'], { queryParams: { collection: collection.uuid } });
// expect(router.navigate).toHaveBeenCalledWith([createPath]);
}); });
}); });

View File

@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, NavigationExtras, Router } from '@angular/router';
import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model'; import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model';
import { DSpaceObject } from '../../../../core/shared/dspace-object.model'; import { DSpaceObject } from '../../../../core/shared/dspace-object.model';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
@@ -28,6 +28,11 @@ export class CreateItemParentSelectorComponent extends DSOSelectorModalWrapperCo
* Navigate to the item create page * Navigate to the item create page
*/ */
navigate(dso: DSpaceObject) { navigate(dso: DSpaceObject) {
// There's no submit path per collection yet... const navigationExtras: NavigationExtras = {
queryParams: {
['collection']: dso.uuid,
}
};
this.router.navigate(['/submit'], navigationExtras);
} }
} }