mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
[CST-4058] Show the name of the community/collection in "Edit group" page
This commit is contained in:
@@ -65,6 +65,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
|||||||
* Dynamic models for the inputs of form
|
* Dynamic models for the inputs of form
|
||||||
*/
|
*/
|
||||||
groupName: DynamicInputModel;
|
groupName: DynamicInputModel;
|
||||||
|
groupCommunity: DynamicInputModel;
|
||||||
groupDescription: DynamicTextAreaModel;
|
groupDescription: DynamicTextAreaModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -160,8 +161,9 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
|||||||
);
|
);
|
||||||
observableCombineLatest(
|
observableCombineLatest(
|
||||||
this.translateService.get(`${this.messagePrefix}.groupName`),
|
this.translateService.get(`${this.messagePrefix}.groupName`),
|
||||||
|
this.translateService.get(`${this.messagePrefix}.groupCommunity`),
|
||||||
this.translateService.get(`${this.messagePrefix}.groupDescription`)
|
this.translateService.get(`${this.messagePrefix}.groupDescription`)
|
||||||
).subscribe(([groupName, groupDescription]) => {
|
).subscribe(([groupName, groupCommunity, groupDescription]) => {
|
||||||
this.groupName = new DynamicInputModel({
|
this.groupName = new DynamicInputModel({
|
||||||
id: 'groupName',
|
id: 'groupName',
|
||||||
label: groupName,
|
label: groupName,
|
||||||
@@ -171,6 +173,13 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
|||||||
},
|
},
|
||||||
required: true,
|
required: true,
|
||||||
});
|
});
|
||||||
|
this.groupCommunity = new DynamicInputModel({
|
||||||
|
id: 'groupCommunity',
|
||||||
|
label: groupCommunity,
|
||||||
|
name: 'groupCommunity',
|
||||||
|
required: false,
|
||||||
|
readOnly: true,
|
||||||
|
});
|
||||||
this.groupDescription = new DynamicTextAreaModel({
|
this.groupDescription = new DynamicTextAreaModel({
|
||||||
id: 'groupDescription',
|
id: 'groupDescription',
|
||||||
label: groupDescription,
|
label: groupDescription,
|
||||||
@@ -179,6 +188,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
|||||||
});
|
});
|
||||||
this.formModel = [
|
this.formModel = [
|
||||||
this.groupName,
|
this.groupName,
|
||||||
|
this.groupCommunity,
|
||||||
this.groupDescription,
|
this.groupDescription,
|
||||||
];
|
];
|
||||||
this.formGroup = this.formBuilderService.createFormGroup(this.formModel);
|
this.formGroup = this.formBuilderService.createFormGroup(this.formModel);
|
||||||
@@ -189,13 +199,27 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
|||||||
).subscribe(([activeGroup, canEdit]) => {
|
).subscribe(([activeGroup, canEdit]) => {
|
||||||
if (activeGroup != null) {
|
if (activeGroup != null) {
|
||||||
this.groupBeingEdited = activeGroup;
|
this.groupBeingEdited = activeGroup;
|
||||||
|
this.getLinkedDSO(activeGroup).subscribe((res) => {
|
||||||
|
if (res?.payload?.name) {
|
||||||
|
this.formGroup.patchValue({
|
||||||
|
groupName: activeGroup != null ? activeGroup.name : '',
|
||||||
|
groupCommunity: res?.payload?.name ?? '',
|
||||||
|
groupDescription: activeGroup != null ? activeGroup.firstMetadataValue('dc.description') : '',
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.formModel = [
|
||||||
|
this.groupName,
|
||||||
|
this.groupDescription,
|
||||||
|
];
|
||||||
this.formGroup.patchValue({
|
this.formGroup.patchValue({
|
||||||
groupName: activeGroup != null ? activeGroup.name : '',
|
groupName: activeGroup != null ? activeGroup.name : '',
|
||||||
groupDescription: activeGroup != null ? activeGroup.firstMetadataValue('dc.description') : '',
|
groupDescription: activeGroup != null ? activeGroup.firstMetadataValue('dc.description') : '',
|
||||||
});
|
});
|
||||||
|
}
|
||||||
if (!canEdit || activeGroup.permanent) {
|
if (!canEdit || activeGroup.permanent) {
|
||||||
this.formGroup.disable();
|
this.formGroup.disable();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@@ -350,6 +350,8 @@
|
|||||||
|
|
||||||
"admin.access-control.groups.form.groupName": "Group name",
|
"admin.access-control.groups.form.groupName": "Group name",
|
||||||
|
|
||||||
|
"admin.access-control.groups.form.groupCommunity": "Community or Collection",
|
||||||
|
|
||||||
"admin.access-control.groups.form.groupDescription": "Description",
|
"admin.access-control.groups.form.groupDescription": "Description",
|
||||||
|
|
||||||
"admin.access-control.groups.form.notification.created.success": "Successfully created Group \"{{name}}\"",
|
"admin.access-control.groups.form.notification.created.success": "Successfully created Group \"{{name}}\"",
|
||||||
|
Reference in New Issue
Block a user