Browse Source

Disabled state fix.

pull/854/head
Sebastian 4 years ago
parent
commit
89e967ee1e
  1. 2
      frontend/src/app/features/content/shared/references/reference-dropdown.component.ts
  2. 2
      frontend/src/app/features/content/shared/references/references-checkboxes.component.ts
  3. 2
      frontend/src/app/features/content/shared/references/references-tags.component.ts
  4. 4
      frontend/src/app/shared/components/references/reference-input.component.html
  5. 12
      frontend/src/app/shared/components/references/reference-input.component.ts

2
frontend/src/app/features/content/shared/references/reference-dropdown.component.ts

@ -175,7 +175,7 @@ export class ReferenceDropdownComponent extends StatefulControlComponent<State,
private resetContentNames(rebuild: boolean) {
const success = this.isValid && !this.isLoadingFailed;
this.onDisabled(!success);
this.onDisabled(!success || this.snapshot.isDisabled);
if (success && rebuild) {
const contentNames: ContentName[] = [

2
frontend/src/app/features/content/shared/references/references-checkboxes.component.ts

@ -118,7 +118,7 @@ export class ReferencesCheckboxesComponent extends StatefulControlComponent<Stat
private resetConverterState() {
const success = this.isValid && this.contentItems && this.contentItems.length > 0;
this.onDisabled(!success);
this.onDisabled(!success || this.snapshot.isDisabled);
let converter: ReferencesTagsConverter;

2
frontend/src/app/features/content/shared/references/references-tags.component.ts

@ -158,7 +158,7 @@ export class ReferencesTagsComponent extends StatefulControlComponent<State, Rea
private resetConverterState(rebuild: boolean) {
const success = this.isValid && !this.isLoadingFailed;
this.onDisabled(!success);
this.onDisabled(!success || this.snapshot.isDisabled);
if (rebuild) {
const converter = new ReferencesTagsConverter(this.language, this.contents, this.localizer);

4
frontend/src/app/shared/components/references/reference-input.component.html

@ -1,7 +1,7 @@
<div class="input-group">
<input class="form-control" readonly [ngModel]="snapshot.selectedName" (click)="contentSelectorDialog.show()" />
<input class="form-control" readonly [ngModel]="snapshot.selectedName" (click)="openDialog()" />
<button type="button" class="btn btn-outline-secondary" (click)="selectContent()" sqxStopClick>
<button type="button" class="btn btn-outline-secondary" [disabled]="snapshot.isDisabled" (click)="selectContent()" sqxStopClick>
<i class="icon-close"></i>
</button>
</div>

12
frontend/src/app/shared/components/references/reference-input.component.ts

@ -86,6 +86,14 @@ export class ReferenceInputComponent extends StatefulControlComponent<State, Rea
});
}
public openDialog() {
if (this.snapshot.isDisabled) {
return;
}
this.contentSelectorDialog.show();
}
public select(contents: ReadonlyArray<ContentDto>) {
if (contents.length > 0) {
this.selectContent(contents[0]);
@ -95,6 +103,10 @@ export class ReferenceInputComponent extends StatefulControlComponent<State, Rea
}
public selectContent(selectedContent?: ContentDto) {
if (this.snapshot.isDisabled) {
return;
}
const id = selectedContent?.id;
if (id) {

Loading…
Cancel
Save