Add "motions_amendments_workflow" config

Adds a config for the default workflow for amendments and maked the
necessary changes to motion detail and amendment wizzard
This commit is contained in:
Sean 2020-07-17 14:37:21 +02:00
parent 6e2e1ebe7a
commit 2c17d7b7aa
3 changed files with 24 additions and 5 deletions

View File

@ -270,7 +270,8 @@ export class AmendmentCreateWizardComponent extends BaseViewComponent implements
category_id: this.motion.category_id, category_id: this.motion.category_id,
tags_id: this.motion.tags_id, tags_id: this.motion.tags_id,
motion_block_id: this.motion.motion_block_id, motion_block_id: this.motion.motion_block_id,
amendment_paragraphs: amendedParagraphs amendment_paragraphs: amendedParagraphs,
workflow_id: this.configService.instant<number>('motions_amendments_workflow')
}; };
const motion = new CreateMotion(); const motion = new CreateMotion();

View File

@ -728,8 +728,9 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit,
this.editMotion = true; this.editMotion = true;
const defaultMotion: Partial<CreateMotion> = {}; const defaultMotion: Partial<CreateMotion> = {};
if (this.route.snapshot.queryParams.parent) { if (this.route.snapshot.queryParams.parent) {
const parentId = +this.route.snapshot.queryParams.parent;
this.amendmentEdit = true; this.amendmentEdit = true;
const parentMotion = this.repo.getViewModel(this.route.snapshot.queryParams.parent); const parentMotion = this.repo.getViewModel(parentId);
const defaultTitle = `${this.translate.instant('Amendment to')} ${parentMotion.identifierOrTitle}`; const defaultTitle = `${this.translate.instant('Amendment to')} ${parentMotion.identifierOrTitle}`;
defaultMotion.title = defaultTitle; defaultMotion.title = defaultTitle;
defaultMotion.parent_id = parentMotion.id; defaultMotion.parent_id = parentMotion.id;
@ -1289,9 +1290,16 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit,
* Sets the default workflow ID during form creation * Sets the default workflow ID during form creation
*/ */
public updateWorkflowIdForCreateForm(paragraph?: number): void { public updateWorkflowIdForCreateForm(paragraph?: number): void {
const isStatuteAmendment = !!this.contentForm.get('statute_amendment').value && !!paragraph; let configKey: string;
const configKey = isStatuteAmendment ? 'motions_statute_amendments_workflow' : 'motions_workflow';
const workflowId = this.configService.instant<string>(configKey); if (!!this.contentForm.get('statute_amendment').value && !!paragraph) {
configKey = 'motions_statute_amendments_workflow';
} else if (!!this.route.snapshot.queryParams.parent) {
configKey = 'motions_amendments_workflow';
} else {
configKey = 'motions_workflow';
}
const workflowId = this.configService.instant(configKey);
this.contentForm.patchValue({ workflow_id: +workflowId }); this.contentForm.patchValue({ workflow_id: +workflowId });
} }

View File

@ -47,6 +47,16 @@ def get_config_variables():
group="Motions", group="Motions",
) )
yield ConfigVariable(
name="motions_amendments_workflow",
default_value="1",
input_type="choice",
label="Workflow of new amendments",
choices=get_workflow_choices,
weight=314,
group="Motions",
)
yield ConfigVariable( yield ConfigVariable(
name="motions_preamble", name="motions_preamble",
default_value="The assembly may decide:", default_value="The assembly may decide:",