Fix amendment creation
Categories and blocks not appear after (paragraph based) amendment creation. Reason for amendments is now required if the config was set accordingly
This commit is contained in:
parent
3490ff3ca4
commit
07d3ea4c25
@ -37,13 +37,54 @@
|
|||||||
<mat-step>
|
<mat-step>
|
||||||
<ng-template matStepLabel>{{ 'Change paragraph' | translate }}</ng-template>
|
<ng-template matStepLabel>{{ 'Change paragraph' | translate }}</ng-template>
|
||||||
|
|
||||||
<h5 translate>Amendment text</h5>
|
<!-- Text -->
|
||||||
<!-- The HTML Editor -->
|
<h3
|
||||||
<editor formControlName="text" [init]="tinyMceSettings"></editor>
|
[ngClass]="
|
||||||
|
contentForm.get('text').invalid &&
|
||||||
|
(contentForm.get('text').dirty || contentForm.get('text').touched)
|
||||||
|
? 'red-warning-text'
|
||||||
|
: ''
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<span translate>Amendment text</span> <span>*</span>
|
||||||
|
</h3>
|
||||||
|
<editor formControlName="text" [init]="tinyMceSettings" required></editor>
|
||||||
|
<div
|
||||||
|
*ngIf="
|
||||||
|
contentForm.get('text').invalid &&
|
||||||
|
(contentForm.get('text').dirty || contentForm.get('text').touched)
|
||||||
|
"
|
||||||
|
class="red-warning-text"
|
||||||
|
translate
|
||||||
|
>
|
||||||
|
This field is required.
|
||||||
|
</div>
|
||||||
|
|
||||||
<h5 translate>Reason</h5>
|
<!-- Reason -->
|
||||||
<!-- The HTML Editor -->
|
<h3
|
||||||
<editor formControlName="reason" [init]="tinyMceSettings"></editor>
|
[ngClass]="
|
||||||
|
reasonRequired &&
|
||||||
|
contentForm.get('reason').invalid &&
|
||||||
|
(contentForm.get('reason').dirty || contentForm.get('reason').touched)
|
||||||
|
? 'red-warning-text'
|
||||||
|
: ''
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<span translate>Reason</span> <span *ngIf="reasonRequired">*</span>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<editor formControlName="reason" [init]="tinyMceSettings" required></editor>
|
||||||
|
<div
|
||||||
|
*ngIf="
|
||||||
|
reasonRequired &&
|
||||||
|
contentForm.get('reason').invalid &&
|
||||||
|
(contentForm.get('reason').dirty || contentForm.get('reason').touched)
|
||||||
|
"
|
||||||
|
class="red-warning-text"
|
||||||
|
translate
|
||||||
|
>
|
||||||
|
This field is required.
|
||||||
|
</div>
|
||||||
</mat-step>
|
</mat-step>
|
||||||
</mat-horizontal-stepper>
|
</mat-horizontal-stepper>
|
||||||
</form>
|
</form>
|
||||||
|
@ -57,16 +57,16 @@ export class AmendmentCreateWizardComponent extends BaseViewComponent {
|
|||||||
*/
|
*/
|
||||||
public contentForm: FormGroup;
|
public contentForm: FormGroup;
|
||||||
|
|
||||||
/**
|
|
||||||
* Motions meta-info
|
|
||||||
*/
|
|
||||||
public metaInfoForm: FormGroup;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates the maximum line length as defined in the configuration.
|
* Indicates the maximum line length as defined in the configuration.
|
||||||
*/
|
*/
|
||||||
public lineLength: number;
|
public lineLength: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine, from the config service, if a reason is required
|
||||||
|
*/
|
||||||
|
public reasonRequired: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs this component.
|
* Constructs this component.
|
||||||
*
|
*
|
||||||
@ -100,6 +100,10 @@ export class AmendmentCreateWizardComponent extends BaseViewComponent {
|
|||||||
this.lineLength = lineLength;
|
this.lineLength = lineLength;
|
||||||
this.getMotionByUrl();
|
this.getMotionByUrl();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.configService.get<boolean>('motions_reason_required').subscribe(required => {
|
||||||
|
this.reasonRequired = required;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -133,15 +137,6 @@ export class AmendmentCreateWizardComponent extends BaseViewComponent {
|
|||||||
text: ['', Validators.required],
|
text: ['', Validators.required],
|
||||||
reason: ['', Validators.required]
|
reason: ['', Validators.required]
|
||||||
});
|
});
|
||||||
this.metaInfoForm = this.formBuilder.group({
|
|
||||||
identifier: [''],
|
|
||||||
category_id: [''],
|
|
||||||
state_id: [''],
|
|
||||||
recommendation_id: [''],
|
|
||||||
submitters_id: [],
|
|
||||||
supporters_id: [[]],
|
|
||||||
origin: ['']
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -172,10 +167,11 @@ export class AmendmentCreateWizardComponent extends BaseViewComponent {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
const newMotionValues = {
|
const newMotionValues = {
|
||||||
...this.metaInfoForm.value,
|
|
||||||
...this.contentForm.value,
|
...this.contentForm.value,
|
||||||
title: this.translate.instant('Amendment to') + ' ' + this.motion.identifier,
|
title: this.translate.instant('Amendment to') + ' ' + this.motion.identifier,
|
||||||
parent_id: this.motion.id,
|
parent_id: this.motion.id,
|
||||||
|
category_id: this.motion.category_id,
|
||||||
|
motion_block_id: this.motion.motion_block_id,
|
||||||
amendment_paragraphs: amendedParagraphs
|
amendment_paragraphs: amendedParagraphs
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<os-head-bar
|
<os-head-bar
|
||||||
[mainButton]="perms.isAllowed('update', motion)"
|
[mainButton]="perms.isAllowed('update', motion)"
|
||||||
mainButtonIcon="edit"
|
mainButtonIcon="edit"
|
||||||
prevUrl="../.."
|
[prevUrl]="backTarget"
|
||||||
[nav]="false"
|
[nav]="false"
|
||||||
[editMode]="editMotion"
|
[editMode]="editMotion"
|
||||||
(mainEvent)="setEditMode(!editMotion)"
|
(mainEvent)="setEditMode(!editMotion)"
|
||||||
|
@ -337,6 +337,13 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit,
|
|||||||
*/
|
*/
|
||||||
private editNotificationSubscription: Subscription;
|
private editNotificationSubscription: Subscription;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine what to "return" to.
|
||||||
|
* Handles the target for clicking the back button
|
||||||
|
* Several angular peculiarities prevent dynamic changing from working right now
|
||||||
|
*/
|
||||||
|
public backTarget = '../..';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs the detail view.
|
* Constructs the detail view.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user