dossier dictionary can be edited by anyone
This commit is contained in:
parent
e08c516c6d
commit
f10e3488e1
@ -57,6 +57,7 @@
|
||||
|
||||
<redaction-dictionary-manager
|
||||
[initialDictionaryEntries]="entries"
|
||||
[canEdit]="permissionsService.isAdmin()"
|
||||
(saveDictionary)="saveEntries($event)"
|
||||
#dictionaryManager
|
||||
></redaction-dictionary-manager>
|
||||
|
||||
@ -6,12 +6,13 @@
|
||||
<redaction-dictionary-manager
|
||||
#dictionaryManager
|
||||
[withFloatingActions]="false"
|
||||
[canEdit]="canEdit"
|
||||
[initialDictionaryEntries]="project.type?.entries"
|
||||
></redaction-dictionary-manager>
|
||||
</div>
|
||||
|
||||
<div class="dialog-actions">
|
||||
<button [disabled]="!dictionaryManager.hasChanges" color="primary" mat-flat-button type="submit">
|
||||
<button [disabled]="!canEdit || !dictionaryManager.hasChanges" color="primary" mat-flat-button type="submit">
|
||||
{{ 'dossier-dictionary-dialog.save-changes' | translate }}
|
||||
</button>
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ import { ProjectWrapper } from '../../../../state/model/project.wrapper';
|
||||
import { DictionaryManagerComponent } from '../../../shared/components/dictionary-manager/dictionary-manager.component';
|
||||
import { DictionarySaveService } from '../../../shared/services/dictionary-save.service';
|
||||
import { AppStateService } from '../../../../state/app-state.service';
|
||||
import { PermissionsService } from '../../../../services/permissions.service';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-dossier-dictionary-dialog',
|
||||
@ -13,12 +14,17 @@ import { AppStateService } from '../../../../state/app-state.service';
|
||||
export class DossierDictionaryDialogComponent {
|
||||
@ViewChild('dictionaryManager', { static: false }) private _dictionaryManager: DictionaryManagerComponent;
|
||||
|
||||
canEdit: boolean = false;
|
||||
|
||||
constructor(
|
||||
public permissionsService: PermissionsService,
|
||||
public dialogRef: MatDialogRef<DossierDictionaryDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public project: ProjectWrapper,
|
||||
private readonly _appStateService: AppStateService,
|
||||
private readonly _dictionarySaveService: DictionarySaveService
|
||||
) {}
|
||||
) {
|
||||
this.canEdit = this.permissionsService.isProjectMember(this.project);
|
||||
}
|
||||
|
||||
saveDossierDictionary() {
|
||||
this._dictionarySaveService
|
||||
|
||||
@ -52,7 +52,7 @@
|
||||
[autoUpdateContent]="true"
|
||||
[mode]="'text'"
|
||||
[options]="aceOptions"
|
||||
[readOnly]="!permissionsService.isAdmin()"
|
||||
[readOnly]="!canEdit"
|
||||
[theme]="'eclipse'"
|
||||
class="ace-redaction"
|
||||
>
|
||||
@ -73,7 +73,7 @@
|
||||
</ace-editor>
|
||||
</div>
|
||||
|
||||
<div *ngIf="withFloatingActions && hasChanges && permissionsService.isAdmin()" [class.offset]="compareForm.get('active').value" class="changes-box">
|
||||
<div *ngIf="withFloatingActions && hasChanges && canEdit" [class.offset]="compareForm.get('active').value" class="changes-box">
|
||||
<redaction-icon-button (action)="saveEntries()" icon="red:check" text="dictionary-overview.save-changes" type="primary"></redaction-icon-button>
|
||||
<div (click)="revert()" class="all-caps-label cancel" translate="dictionary-overview.revert-changes"></div>
|
||||
</div>
|
||||
|
||||
@ -24,6 +24,9 @@ export class DictionaryManagerComponent implements OnInit, OnChanges {
|
||||
@Input()
|
||||
initialDictionaryEntries: string[];
|
||||
|
||||
@Input()
|
||||
canEdit: boolean = false;
|
||||
|
||||
@Output()
|
||||
saveDictionary = new EventEmitter<string[]>();
|
||||
|
||||
@ -47,7 +50,6 @@ export class DictionaryManagerComponent implements OnInit, OnChanges {
|
||||
@ViewChild('compareEditorComponent') private _compareEditorComponent: AceEditorComponent;
|
||||
|
||||
constructor(
|
||||
readonly permissionsService: PermissionsService,
|
||||
private readonly _notificationService: NotificationService,
|
||||
protected readonly _translateService: TranslateService,
|
||||
private readonly _dictionaryControllerService: DictionaryControllerService,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user