Skip to content

Commit

Permalink
Merge pull request DSpace#2620 from atmire/w2p-108045_repeatable-date…
Browse files Browse the repository at this point in the history
…-fields-label-fix_contribute-main

Fix for repeatable date field labels
  • Loading branch information
tdonohue authored Nov 10, 2023
2 parents dfb0bbd + 0d39fe4 commit 497ab09
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ describe('DsDynamicFormControlContainerComponent test suite', () => {
metadataFields: [],
hasSelectableMetadata: false
}),
new DynamicDsDatePickerModel({ id: 'datepicker' }),
new DynamicDsDatePickerModel({ id: 'datepicker', repeatable: false }),
new DynamicLookupModel({
id: 'lookup',
metadataFields: [],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div>
<fieldset class="d-flex">
<legend [id]="'legend_' + model.id" [ngClass]="[getClass('element', 'label'), getClass('grid', 'label')]">
<legend *ngIf="!model.repeatable" [id]="'legend_' + model.id" [ngClass]="[getClass('element', 'label'), getClass('grid', 'label')]">
{{model.placeholder}} <span *ngIf="model.required">*</span>
</legend>
<ds-number-picker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const DATE_TEST_MODEL_CONFIG = {
placeholder: 'Date',
readOnly: false,
required: true,
repeatable: false,
toggleIcon: 'fas fa-calendar'
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const DYNAMIC_FORM_CONTROL_TYPE_DSDATEPICKER = 'DATE';
export interface DynamicDsDateControlModelConfig extends DynamicDatePickerModelConfig {
legend?: string;
typeBindRelations?: DynamicFormControlRelation[];
repeatable: boolean;
}

/**
Expand All @@ -37,7 +38,7 @@ export class DynamicDsDatePickerModel extends DynamicDateControlModel {
this.metadataValue = (config as any).metadataValue;
this.typeBindRelations = config.typeBindRelations ? config.typeBindRelations : [];
this.hiddenUpdates = new BehaviorSubject<boolean>(this.hidden);

this.repeatable = config.repeatable;
// This was a subscription, then an async setTimeout, but it seems unnecessary
const parentModel = this.getRootParent(this);
if (parentModel && isNotUndefined(parentModel.hidden)) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/form/builder/form-builder.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ describe('FormBuilderService test suite', () => {
hasSelectableMetadata: true
}),

new DynamicDsDatePickerModel({ id: 'testDate' }),
new DynamicDsDatePickerModel({ id: 'testDate', repeatable: false}),

new DynamicLookupModel({
id: 'testLookup',
Expand Down

0 comments on commit 497ab09

Please sign in to comment.