Skip to content

Commit 63f5072

Browse files
alisaismailatiFrancescoMolinaro
authored andcommitted
Merged in task/dspace-cris-2023_02_x/DSC-1782 (pull request DSpace#1934)
[DSC-1782] Merge pull request #119 from ub-unibe-ch/RHD-13250-descriptive-text-for-submission-dropdowns Approved-by: Francesco Molinaro
2 parents 1386451 + dc1ad55 commit 63f5072

File tree

9 files changed

+63
-6
lines changed

9 files changed

+63
-6
lines changed

src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.html

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
<div>
2020
<ng-container #componentViewContainer></ng-container>
2121
</div>
22-
<small
23-
*ngIf="hasHint &&
22+
<div class="d-flex flex-column w-100">
23+
<small
24+
*ngIf="hasHint &&
2425
(formBuilderService.hasArrayGroupValue(model) ||
2526
(
2627
(!model.repeatable
@@ -31,8 +32,12 @@
3132
|| (model.repeatable === true && context?.index === context?.context?.groups?.length - 1 )
3233
|| hasHintAndIsRepeatable
3334
|| (model.type==='TAG')) && (!showErrorMessages || errorMessages.length === 0)"
34-
class="text-muted ds-hint" [innerHTML]="model.hint | translate" [ngClass]="getClass('element', 'hint')"
35-
></small>
35+
class="text-muted ds-hint" [innerHTML]="model.hint | translate" [ngClass]="getClass('element', 'hint')"
36+
></small>
37+
<small class="text-muted mt-2" *ngIf="formBuilderService.isScrollableDropdown(model) && enabledDropdownHints[model?.metadataFields[0]] && (model.value?.value) !== null">
38+
<i class="fas fa-info-circle mr-2"></i>{{'submission.dropdown.hint.' + model.value?.value | translate}}
39+
</small>
40+
</div>
3641
<!-- In case of repeatable fields show empty space for all elements except the first -->
3742
<!-- In case of not repeatable field with multiple values show empty space for all elements except the last -->
3843
<div *ngIf="(context?.index !== null && (!showErrorMessages || errorMessages.length === 0)) || (!hasHint && !showErrorMessages) ||

src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ import { FormBuilderService } from '../form-builder.service';
8282
import { NgxMaskModule } from 'ngx-mask';
8383
import { APP_CONFIG } from '../../../../../config/app-config.interface';
8484
import { environment } from '../../../../../environments/environment';
85+
import { getMockFormBuilderService } from '../../../mocks/form-builder-service.mock';
8586

8687
function getMockDsDynamicTypeBindRelationService(): DsDynamicTypeBindRelationService {
8788
return jasmine.createSpyObj('DsDynamicTypeBindRelationService', {
@@ -246,7 +247,7 @@ describe('DsDynamicFormControlContainerComponent test suite', () => {
246247
{ provide: RelationshipDataService, useValue: {} },
247248
{ provide: SelectableListService, useValue: {} },
248249
{ provide: FormService, useValue: {} },
249-
{ provide: FormBuilderService, useValue: {} },
250+
{ provide: FormBuilderService, useValue: getMockFormBuilderService() },
250251
{ provide: SubmissionService, useValue: {} },
251252
{
252253
provide: SubmissionObjectDataService,

src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ import { itemLinksToFollow } from '../../../utils/relation-query.utils';
124124
import { DynamicConcatModel } from './models/ds-dynamic-concat.model';
125125
import { Metadata } from '../../../../core/shared/metadata.utils';
126126
import { DynamicLinkModel } from './models/ds-dynamic-link.model';
127+
import { environment } from '../../../../../environments/environment';
127128

128129
export function dsDynamicFormControlMapFn(model: DynamicFormControlModel): Type<DynamicFormControl> | null {
129130
switch (model.type) {
@@ -248,6 +249,8 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
248249
return dsDynamicFormControlMapFn(this.model);
249250
}
250251

252+
enabledDropdownHints = environment.submission.dropdownHintEnabled;
253+
251254
constructor(
252255
protected componentFactoryResolver: ComponentFactoryResolver,
253256
protected dynamicFormComponentService: DynamicFormComponentService,
@@ -357,7 +360,6 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
357360
} else {
358361
this.securityLevel = this.model.securityLevel;
359362
}
360-
361363
}
362364

363365
get isCheckbox(): boolean {

src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export class DsDynamicScrollableDropdownComponent extends DsDynamicVocabularyCom
6262
*/
6363
subSearch: Subscription;
6464

65+
6566
constructor(protected vocabularyService: VocabularyService,
6667
protected cdr: ChangeDetectorRef,
6768
protected layoutService: DynamicFormLayoutService,

src/app/shared/form/builder/form-builder.service.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ import { CONCAT_GROUP_SUFFIX, DynamicConcatModel } from './ds-dynamic-form-ui/mo
5151
import { VIRTUAL_METADATA_PREFIX } from '../../../core/shared/metadata.models';
5252
import { ConfigurationDataService } from '../../../core/data/configuration-data.service';
5353
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
54+
import {
55+
DYNAMIC_FORM_CONTROL_TYPE_SCROLLABLE_DROPDOWN
56+
} from './ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.model';
5457

5558
@Injectable()
5659
export class FormBuilderService extends DynamicFormService {
@@ -398,6 +401,10 @@ export class FormBuilderService extends DynamicFormService {
398401
|| this.isRelationGroup((model as any).parent));
399402
}
400403

404+
isScrollableDropdown(model: DynamicFormControlModel): boolean {
405+
return model && (model.type === DYNAMIC_FORM_CONTROL_TYPE_SCROLLABLE_DROPDOWN);
406+
}
407+
401408
isGroup(model: DynamicFormControlModel): boolean {
402409
return model && (model.type === DYNAMIC_FORM_CONTROL_TYPE_GROUP || model.type === DYNAMIC_FORM_CONTROL_TYPE_CHECKBOX_GROUP);
403410
}

src/app/shared/mocks/form-builder-service.mock.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export function getMockFormBuilderService(): FormBuilderService {
2222
isRelationGroup: true,
2323
isConcatGroup: false,
2424
hasArrayGroupValue: true,
25+
isScrollableDropdown: false,
2526
getTypeBindModel: new DsDynamicInputModel({
2627
name: 'dc.type',
2728
id: 'dc_type',

src/assets/i18n/en.json5

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5708,6 +5708,30 @@
57085708

57095709
"statistics.reports.title": "Reports",
57105710

5711+
"submission.dropdown.hint.open": "Open data means the data files you submit will be openly accessible and downloadable without any restrictions.",
5712+
5713+
"submission.dropdown.hint.embargoed": " Apply an Embargo if you have to hold your data back for a specific time period, e.g. due to a non-disclosure-agreement. Specify the embargo end date manually. If you want to permit individuals to request access before the embargo ends, you can include a Data Transfer Agreement (DTA).",
5714+
5715+
"submission.dropdown.hint.restricted": "Restricted means that data are uploaded to the repository, but users cannot download data without your permission. They have to request access. Then please include a Data Transfer Agreement (DTA), specifying data sharing conditions, in the submission step “Upload” Select this option if you want to upload anonymized data that need special protection, e.g. in medical research. Be aware that your funder might request to publish your data openly (Data Availability type: Open) if it was fully anonymized. If you still would like to restrict your anonymised data and nonetheless permit individual users to gain access to it, you may upload a Data Transfer Agreement (DTA) under “Upload”, specifying your data sharing conditions. We also recommend to upload a supplemental material under “Supplement Upload” to document your data.",
5716+
5717+
"submission.dropdown.hint.closed": "Closed means that NO DATA will be uploaded. Metadata can be entered.Choose this option if your data cannot be shared via the repository.If you want to grant access to users, you can include a Data Transfer Agreement (DTA) in the submission step “Upload”.",
5718+
5719+
"submission.dropdown.hint.metadataOnly": "Metadata Only means that no data will be uploaded, but metadata will be entered. Choose this option if your data has been shared elsewhere, and provide details about this location below (External Resource).",
5720+
5721+
"submission.dropdown.hint.DataCollector": "Person responsible for maintaining final dataset.",
5722+
5723+
"submission.dropdown.hint.DataCurator": "Person tasked with reviewing, enhancing, cleaning, or standardizing data.",
5724+
5725+
"submission.dropdown.hint.DataManger": "Person responsible for maintaining final dataset.",
5726+
5727+
"submission.dropdown.hint.ProjectLeader": "Leader of a research project, Principal Investigator (PI).",
5728+
5729+
"submission.dropdown.hint.ProjectManager": "Person who manages a research project",
5730+
5731+
"submission.dropdown.hint.ProjectMember": "Research fellow, collaborator or other person who works in a research project. ",
5732+
5733+
"submission.dropdown.hint.Supervisor": "",
5734+
57115735
"submission.edit.breadcrumbs": "Edit Submission",
57125736

57135737
"submission.edit.title": "Edit Submission",
@@ -6610,6 +6634,12 @@
66106634

66116635
"submission.workspace.generic.view-help": "Select this option to view the item's metadata",
66126636

6637+
"submission.product.roles.info": "<div class='my-2'><b>1. Project Leader:</b><br/> Leader of a research project, Principal Investigator (PI).</div><br/><div class='my-2'><b>2. Project Member:</b><br/> Research fellow, collaborator or other person who works in a research project.</div><br/><div class='my-2'><b>3. Research Group Leader</b></div><br/><div class='my-2'><b>4. Project Manager:</b><br/> Person who manages a research project.</div><br/><div class='my-2'><b>5. Data Manager:</b><br/> Person responsible for maintaining final dataset.</div><br/><div class='my-2'><b>6. Data Collector:</b><br/> Person responsible for finding, gathering, collecting, or otherwise generating data.</div><br/><div class='my-2'><b>7. Data Curator:</b><br/> Person tasked with reviewing, enhancing, cleaning, or standardizing data.</div>",
6638+
6639+
"submission.product.dataavailability.info": "<div class='my-2'><b>Open</b><br/> - Open data means the data files you submit will be openly accessible and downloadable without any restrictions.</div> <br/><div class='my-2'><b>Embargoed</b><br/> - Apply an Embargo if you have to hold your data back for a specific time period, e.g. due to a non-disclosure-agreement. Specify the embargo end date manually. If you want to permit individuals to request access before the embargo ends, you can include a Data Transfer Agreement (DTA).</div><br/><div class='my-2'><b>Restricted</b><br/> - Restricted means that data are uploaded to the repository, but users cannot download data without your permission. They have to request access. Then please include a Data Transfer Agreement (DTA), specifying data sharing conditions, in the submission step “Upload” Select this option if you want to upload anonymized data that need special protection, e.g. in medical research.<br/>Be aware that your funder might request to publish your data openly (Data Availability type: Open) if it was fully anonymized. If you still would like to restrict your anonymised data and nonetheless permit individual users to gain access to it, you may upload a Data Transfer Agreement (DTA) under “Upload”, specifying your data sharing conditions. We also recommend to upload a supplemental material under “Supplement Upload” to document your data.</div><br/><div class='my-2'><b>Closed</b><br/> - Closed means that NO DATA will be uploaded. Metadata can be entered.Choose this option if your data cannot be shared via the repository.If you want to grant access to users, you can include a Data Transfer Agreement (DTA) in the submission step “Upload”</div>.<br/><div class='my-2'><b>Metadata Only</b><br/> - Metadata Only means that no data will be uploaded, but metadata will be entered. Choose this option if your data has been shared elsewhere, and provide details about this location below (External Resource).</div>",
6640+
6641+
"submission.roles.modal.open": "Roles Info",
6642+
66136643
"submitter.empty": "N/A",
66146644

66156645
"subscriptions.title": "Subscriptions",

src/config/default-app-config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,10 @@ export class DefaultAppConfig implements AppConfig {
289289
metadataDetailsList: [
290290
{ label: 'Document type', name: 'dc.type' }
291291
]
292+
},
293+
dropdownHintEnabled: {
294+
// NOTE: list of metadata fields for which the dropdown hint is enabled
295+
// eg. 'dc.access.rights': true,
292296
}
293297
};
294298

src/config/submission-config.interface.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,15 @@ interface DetectDuplicateConfig extends Config {
3838
metadataDetailsList: DuplicateMatchMetadataDetailConfig[];
3939
}
4040

41+
export interface SubmissionDropdownHintEnabled {
42+
[key: string]: boolean
43+
44+
}
45+
4146
export interface SubmissionConfig extends Config {
4247
autosave: AutosaveConfig;
4348
typeBind: TypeBindConfig;
4449
icons: IconsConfig;
4550
detectDuplicate: DetectDuplicateConfig;
51+
dropdownHintEnabled?: SubmissionDropdownHintEnabled;
4652
}

0 commit comments

Comments
 (0)