[CST-3105] done

This commit is contained in:
Danilo Di Nuzzo
2020-06-18 11:30:45 +02:00
parent f33f391eb3
commit 136e36afab
2 changed files with 26 additions and 2 deletions

View File

@@ -1,5 +1,20 @@
<div>
<div ngbDropdown #collectionControls="ngbDropdown" class="btn-group input-group" (openChange)="toggled($event)">
<div
*ngIf="!(available$ | async)"
class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">{{ 'submission.sections.general.collection' | translate }}</span>
</div>
<div class="input-group-append">
<span class="input-group-text">{{ selectedCollectionName$ | async }}</span>
</div>
</div>
<div
ngbDropdown
#collectionControls="ngbDropdown"
*ngIf="(available$ | async)"
class="btn-group input-group"
(openChange)="toggled($event)">
<div class="input-group-prepend">
<span id="collectionControlsMenuLabel" class="input-group-text">
{{ 'submission.sections.general.collection' | translate }}

View File

@@ -28,6 +28,7 @@ import { SubmissionObject } from '../../../core/submission/models/submission-obj
import { SubmissionJsonPatchOperationsService } from '../../../core/submission/submission-json-patch-operations.service';
import { CollectionDataService } from '../../../core/data/collection-data.service';
import { CollectionDropdownComponent } from 'src/app/shared/collection-dropdown/collection-dropdown.component';
import { SectionsService } from '../../sections/sections.service';
/**
* This component allows to show the current collection the submission belonging to and to change it.
@@ -98,6 +99,12 @@ export class SubmissionFormCollectionComponent implements OnChanges, OnInit {
*/
@ViewChild(CollectionDropdownComponent, {static: false}) collectionDropdown: CollectionDropdownComponent;
/**
* A boolean representing if the collection section is available
* @type {BehaviorSubject<boolean>}
*/
available$: Observable<boolean>;
/**
* Initialize instance variables
*
@@ -112,7 +119,8 @@ export class SubmissionFormCollectionComponent implements OnChanges, OnInit {
private collectionDataService: CollectionDataService,
private operationsBuilder: JsonPatchOperationsBuilder,
private operationsService: SubmissionJsonPatchOperationsService,
private submissionService: SubmissionService) {
private submissionService: SubmissionService,
private sectionsService: SectionsService) {
}
/**
@@ -135,6 +143,7 @@ export class SubmissionFormCollectionComponent implements OnChanges, OnInit {
*/
ngOnInit() {
this.pathCombiner = new JsonPatchOperationPathCombiner('sections', 'collection');
this.available$ = this.sectionsService.isSectionAvailable(this.submissionId, 'collection');
}
/**