Skip to content

Commit 74c2f3d

Browse files
authored
Merge pull request #2405 from alexandrevryghem/fix-collection-form-bugs_contribute-maintenance-7.6
[Port dspace-7_x] Fix minor collection form bugs
2 parents f22fcc7 + ebaccc0 commit 74c2f3d

4 files changed

Lines changed: 11 additions & 12 deletions

File tree

src/app/access-control/epeople-registry/eperson-form/eperson-form.component.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@ <h4>{{messagePrefix + '.edit' | translate}}</h4>
1616
[submitLabel]="submitLabel"
1717
(submitForm)="onSubmit()">
1818
<div before class="btn-group">
19-
<button (click)="onCancel()"
19+
<button (click)="onCancel()" type="button"
2020
class="btn btn-outline-secondary"><i class="fas fa-arrow-left"></i> {{messagePrefix + '.return' | translate}}</button>
2121
</div>
2222
<div *ngIf="displayResetPassword" between class="btn-group">
23-
<button class="btn btn-primary" [disabled]="!(canReset$ | async)" (click)="resetPassword()">
23+
<button class="btn btn-primary" [disabled]="!(canReset$ | async)" type="button" (click)="resetPassword()">
2424
<i class="fa fa-key"></i> {{'admin.access-control.epeople.actions.reset' | translate}}
2525
</button>
2626
</div>
2727
<div between class="btn-group ml-1">
28-
<button *ngIf="!isImpersonated" class="btn btn-primary" [ngClass]="{'d-none' : !(canImpersonate$ | async)}" (click)="impersonate()">
28+
<button *ngIf="!isImpersonated" class="btn btn-primary" type="button" [ngClass]="{'d-none' : !(canImpersonate$ | async)}" (click)="impersonate()">
2929
<i class="fa fa-user-secret"></i> {{'admin.access-control.epeople.actions.impersonate' | translate}}
3030
</button>
31-
<button *ngIf="isImpersonated" class="btn btn-primary" (click)="stopImpersonating()">
31+
<button *ngIf="isImpersonated" class="btn btn-primary" type="button" (click)="stopImpersonating()">
3232
<i class="fa fa-user-secret"></i> {{'admin.access-control.epeople.actions.stop-impersonating' | translate}}
3333
</button>
3434
</div>
35-
<button after class="btn btn-danger delete-button" [disabled]="!(canDelete$ | async)" (click)="delete()">
35+
<button after class="btn btn-danger delete-button" type="button" [disabled]="!(canDelete$ | async)" (click)="delete()">
3636
<i class="fas fa-trash"></i> {{'admin.access-control.epeople.actions.delete' | translate}}
3737
</button>
3838
</ds-form>

src/app/access-control/group-registry/group-form/group-form.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ <h2 class="border-bottom pb-2">
3636
[displayCancel]="false"
3737
(submitForm)="onSubmit()">
3838
<div before class="btn-group">
39-
<button (click)="onCancel()"
39+
<button (click)="onCancel()" type="button"
4040
class="btn btn-outline-secondary"><i class="fas fa-arrow-left"></i> {{messagePrefix + '.return' | translate}}</button>
4141
</div>
4242
<div after *ngIf="groupBeingEdited != null" class="btn-group">
4343
<button class="btn btn-danger delete-button" [disabled]="!(canEdit$ | async) || groupBeingEdited.permanent"
44-
(click)="delete()">
44+
(click)="delete()" type="button">
4545
<i class="fa fa-trash"></i> {{ messagePrefix + '.actions.delete' | translate}}
4646
</button>
4747
</div>

src/app/collection-page/collection-form/collection-form.component.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,8 @@ export class CollectionFormComponent extends ComColFormComponent<Collection> imp
9898
// retrieve all entity types to populate the dropdowns selection
9999
entities$.subscribe((entityTypes: ItemType[]) => {
100100

101-
entityTypes
102-
.filter((type: ItemType) => type.label !== NONE_ENTITY_TYPE)
103-
.forEach((type: ItemType, index: number) => {
101+
entityTypes = entityTypes.filter((type: ItemType) => type.label !== NONE_ENTITY_TYPE);
102+
entityTypes.forEach((type: ItemType, index: number) => {
104103
this.entityTypeSelection.add({
105104
disabled: false,
106105
label: type.label,
@@ -112,7 +111,7 @@ export class CollectionFormComponent extends ComColFormComponent<Collection> imp
112111
}
113112
});
114113

115-
this.formModel = [...collectionFormModels, this.entityTypeSelection];
114+
this.formModel = entityTypes.length === 0 ? collectionFormModels : [...collectionFormModels, this.entityTypeSelection];
116115

117116
super.ngOnInit();
118117
this.chd.detectChanges();

src/app/shared/comcol/comcol-forms/comcol-form/comcol-form.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
[formModel]="formModel"
4343
[displayCancel]="false"
4444
(submitForm)="onSubmit()">
45-
<button before (click)="back.emit()" class="btn btn-outline-secondary">
45+
<button before (click)="back.emit()" class="btn btn-outline-secondary" type="button">
4646
<i class="fas fa-arrow-left"></i> {{ type.value + '.edit.return' | translate }}
4747
</button>
4848
</ds-form>

0 commit comments

Comments
 (0)