From 4b8076c5629682d65be0b88fdb4e402be437de57 Mon Sep 17 00:00:00 2001 From: Sean Engelhardt Date: Mon, 13 Aug 2018 13:49:38 +0200 Subject: [PATCH] Hide unset motion detail values. --- .../src/app/shared/models/motions/motion.ts | 33 ++++++++++++++- .../motion-detail.component.html | 42 ++++++++++++------- .../motion-detail.component.scss | 2 + 3 files changed, 61 insertions(+), 16 deletions(-) diff --git a/client/src/app/shared/models/motions/motion.ts b/client/src/app/shared/models/motions/motion.ts index f9050033b..3a398df3b 100644 --- a/client/src/app/shared/models/motions/motion.ts +++ b/client/src/app/shared/models/motions/motion.ts @@ -144,7 +144,7 @@ export class Motion extends BaseModel { /** * return the workflow state * - * Right now only the default workflow is assumes + * Right now only the default workflow is assumed * TODO: Motion workflow needs to be specific on the server */ get stateName() { @@ -157,6 +157,37 @@ export class Motion extends BaseModel { return selectedWorkflow.getStateNameById(this.state_id); } + /** + * Returns the name of the recommendation. + * + * Right now only the default workflow is assumed + * TODO: Motion workflow needs to be specific on the server + */ + get recommendation() { + //get the default workflow + const motionsWorkflowConfig = this.DS.filter(Config, config => config.key === 'motions_workflow')[0] as Config; + const workflowId = +motionsWorkflowConfig.value; + const selectedWorkflow = this.DS.get(Workflow, workflowId) as Workflow; + const stateName = selectedWorkflow.getStateNameById(this.recommendation_id); + if (stateName !== 'NULL') { + return stateName; + } else { + return ''; + } + } + + /** + * returns the value of 'config.motions_recommendations_by' + */ + get recomBy() { + const motionsRecommendationsByConfig = this.DS.filter( + Config, + config => config.key === 'motions_recommendations_by' + )[0] as Config; + const recomByString = motionsRecommendationsByConfig.value; + return recomByString; + } + deserialize(input: any): this { Object.assign(this, input); diff --git a/client/src/app/site/motions/motion-detail/motion-detail.component.html b/client/src/app/site/motions/motion-detail/motion-detail.component.html index 4d05dd860..8ef118542 100644 --- a/client/src/app/site/motions/motion-detail/motion-detail.component.html +++ b/client/src/app/site/motions/motion-detail/motion-detail.component.html @@ -7,7 +7,7 @@
- Motion {{motion.identifier}} {{motion.currentTitle}} + Motion {{motion.identifier}}: {{motion.currentTitle}}
by {{motion.submitterName}} @@ -16,7 +16,8 @@ - + + @@ -24,19 +25,30 @@
-

Submitters

- {{motion.submitterName}} -

Supporters

-

Status

- {{motion.stateName}} -

Empfehlung der ABK

-

Category

- {{motion.category}} -

Origin

-

Voting

+ +

Submitters

+ {{motion.submitterName}} + +

Supporters

+ +

Status

+ {{motion.stateName}} + +

{{motion.recomBy}}

+ + {{motion.recommendation}} + +

Category

+ {{motion.category}} + +

Origin

+ {{motion.origin}} + +

Voting

- + + @@ -55,8 +67,8 @@

The assembly may decide:

- -

Reason

+ +

Reason

diff --git a/client/src/app/site/motions/motion-detail/motion-detail.component.scss b/client/src/app/site/motions/motion-detail/motion-detail.component.scss index 5a4baecaa..df125c158 100644 --- a/client/src/app/site/motions/motion-detail/motion-detail.component.scss +++ b/client/src/app/site/motions/motion-detail/motion-detail.component.scss @@ -23,6 +23,8 @@ mat-panel-title { padding-top: 25px; h3 { display: block; + margin-top: 12px; //distance between heading and text + margin-bottom: 3px; //distance between heading and text font-size: 80%; color: gray; }