Merge pull request #5276 from tsiegleauq/changeable-created-polls
Remove pseudo-disabled values in poll form
This commit is contained in:
commit
91be76a263
@ -66,7 +66,13 @@ export class CheckInputComponent extends BaseViewComponent implements OnInit, Co
|
|||||||
* Subscribes to value-changes of the form-control.
|
* Subscribes to value-changes of the form-control.
|
||||||
*/
|
*/
|
||||||
public ngOnInit(): void {
|
public ngOnInit(): void {
|
||||||
this.subscriptions.push(this.contentForm.valueChanges.subscribe(value => this.sendValue(value)));
|
this.subscriptions.push(
|
||||||
|
this.contentForm.valueChanges.subscribe(value => {
|
||||||
|
if (value) {
|
||||||
|
this.sendValue(value);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -8,17 +8,6 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<!-- TODO: rather disable forms than duplicate them -->
|
|
||||||
<div *ngIf="data && data.state" class="poll-preview-meta-info">
|
|
||||||
<span class="short-description" *ngFor="let value of pollValues">
|
|
||||||
<span class="short-description-label subtitle">
|
|
||||||
{{ value[0] }}
|
|
||||||
</span>
|
|
||||||
<span class="short-description-value">
|
|
||||||
{{ value[1] }}
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<form [formGroup]="contentForm" class="poll-preview-meta-info-form">
|
<form [formGroup]="contentForm" class="poll-preview-meta-info-form">
|
||||||
<ng-container *ngIf="!data || !data.state || data.isCreated">
|
<ng-container *ngIf="!data || !data.state || data.isCreated">
|
||||||
<!-- Poll Type -->
|
<!-- Poll Type -->
|
||||||
|
@ -125,6 +125,10 @@ export class PollFormComponent<T extends ViewBasePoll, S extends PollService> ex
|
|||||||
this.groupObservable = this.groupRepo.getViewModelListObservableWithoutDefaultGroup();
|
this.groupObservable = this.groupRepo.getViewModelListObservableWithoutDefaultGroup();
|
||||||
|
|
||||||
if (this.data) {
|
if (this.data) {
|
||||||
|
if (this.data.state) {
|
||||||
|
this.disablePollType();
|
||||||
|
}
|
||||||
|
|
||||||
if (this.data instanceof ViewAssignmentPoll) {
|
if (this.data instanceof ViewAssignmentPoll) {
|
||||||
if (this.data.assignment && !this.data.votes_amount) {
|
if (this.data.assignment && !this.data.votes_amount) {
|
||||||
this.data.votes_amount = this.data.assignment.open_posts;
|
this.data.votes_amount = this.data.assignment.open_posts;
|
||||||
@ -164,6 +168,10 @@ export class PollFormComponent<T extends ViewBasePoll, S extends PollService> ex
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private disablePollType(): void {
|
||||||
|
this.contentForm.get('type').disable();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* updates the available percent bases according to the pollmethod
|
* updates the available percent bases according to the pollmethod
|
||||||
* @param method the currently chosen pollmethod
|
* @param method the currently chosen pollmethod
|
||||||
|
Loading…
Reference in New Issue
Block a user