From 07d3ea4c25d2a5af5c182bb9143152de3cfd37a8 Mon Sep 17 00:00:00 2001 From: Sean Engelhardt Date: Fri, 8 Mar 2019 16:45:45 +0100 Subject: [PATCH] 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 --- .../amendment-create-wizard.component.html | 53 ++++++++++++++++--- .../amendment-create-wizard.component.ts | 26 ++++----- .../motion-detail.component.html | 2 +- .../motion-detail/motion-detail.component.ts | 7 +++ 4 files changed, 66 insertions(+), 22 deletions(-) diff --git a/client/src/app/site/motions/modules/motion-detail/components/amendment-create-wizard/amendment-create-wizard.component.html b/client/src/app/site/motions/modules/motion-detail/components/amendment-create-wizard/amendment-create-wizard.component.html index 09b6948b4..d38ff9832 100644 --- a/client/src/app/site/motions/modules/motion-detail/components/amendment-create-wizard/amendment-create-wizard.component.html +++ b/client/src/app/site/motions/modules/motion-detail/components/amendment-create-wizard/amendment-create-wizard.component.html @@ -37,13 +37,54 @@ {{ 'Change paragraph' | translate }} -
Amendment text
- - + +

+ Amendment text * +

+ +
+ This field is required. +
-
Reason
- - + +

+ Reason * +

+ + +
+ This field is required. +
diff --git a/client/src/app/site/motions/modules/motion-detail/components/amendment-create-wizard/amendment-create-wizard.component.ts b/client/src/app/site/motions/modules/motion-detail/components/amendment-create-wizard/amendment-create-wizard.component.ts index a6e03a1bb..c981921e5 100644 --- a/client/src/app/site/motions/modules/motion-detail/components/amendment-create-wizard/amendment-create-wizard.component.ts +++ b/client/src/app/site/motions/modules/motion-detail/components/amendment-create-wizard/amendment-create-wizard.component.ts @@ -57,16 +57,16 @@ export class AmendmentCreateWizardComponent extends BaseViewComponent { */ public contentForm: FormGroup; - /** - * Motions meta-info - */ - public metaInfoForm: FormGroup; - /** * Indicates the maximum line length as defined in the configuration. */ public lineLength: number; + /** + * Determine, from the config service, if a reason is required + */ + public reasonRequired: boolean; + /** * Constructs this component. * @@ -100,6 +100,10 @@ export class AmendmentCreateWizardComponent extends BaseViewComponent { this.lineLength = lineLength; this.getMotionByUrl(); }); + + this.configService.get('motions_reason_required').subscribe(required => { + this.reasonRequired = required; + }); } /** @@ -133,15 +137,6 @@ export class AmendmentCreateWizardComponent extends BaseViewComponent { text: ['', 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 = { - ...this.metaInfoForm.value, ...this.contentForm.value, title: this.translate.instant('Amendment to') + ' ' + this.motion.identifier, parent_id: this.motion.id, + category_id: this.motion.category_id, + motion_block_id: this.motion.motion_block_id, amendment_paragraphs: amendedParagraphs }; diff --git a/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.html b/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.html index 64e60ac78..e20222143 100644 --- a/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.html +++ b/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.html @@ -1,7 +1,7 @@