From d7748ff7b09ca4456000320d2d2a871f460118dc Mon Sep 17 00:00:00 2001 From: mama Date: Tue, 19 Dec 2017 11:44:12 +0100 Subject: [PATCH] =?UTF-8?q?Affichage=20du=20type=20de=20salaire=20dans=20M?= =?UTF-8?q?es=20r=C3=A9ponses?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/components/Simulateur.js | 24 +++++++++++++------ .../components/conversation/FormDecorator.js | 10 ++++---- source/engine/generateQuestions.js | 3 +-- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/source/components/Simulateur.js b/source/components/Simulateur.js index 7a16e05ff..d2947bd87 100644 --- a/source/components/Simulateur.js +++ b/source/components/Simulateur.js @@ -6,7 +6,12 @@ import { connect } from 'react-redux' import { withRouter, Redirect } from 'react-router-dom' import { START_CONVERSATION } from '../actions' -import { rules, findRuleByName, decodeRuleName } from 'Engine/rules' +import { + rules, + findRuleByName, + findRuleByDottedName, + decodeRuleName +} from 'Engine/rules' import './conversation/conversation.css' import './Simulateur.css' import Conversation from './conversation/Conversation' @@ -31,7 +36,7 @@ import Explanation from 'Components/Explanation' analysis: state.analysis }), dispatch => ({ - startConversation: (targetNames, fromScratch=false) => + startConversation: (targetNames, fromScratch = false) => dispatch({ type: START_CONVERSATION, targetNames, fromScratch }), resetForm: () => dispatch(reset('conversation')), resetFormField: name => dispatch(change('conversation', name, '')) @@ -117,7 +122,11 @@ export default class extends Component { }} /> - {done && } + {done && ( + + )} ) } @@ -130,10 +139,10 @@ export default class extends Component { let step = makeQuestion(rules, targetNames)(question) let fieldName = - (unfolded && - inputInversions && - R.path(step.dottedName.split('.'), inputInversions)) || - step.dottedName + (inputInversions && + R.path(step.dottedName.split('.'), inputInversions)) || + step.dottedName, + fieldTitle = findRuleByDottedName(rules, fieldName).title return ( ) diff --git a/source/components/conversation/FormDecorator.js b/source/components/conversation/FormDecorator.js index 29e00eb62..401939a41 100644 --- a/source/components/conversation/FormDecorator.js +++ b/source/components/conversation/FormDecorator.js @@ -144,10 +144,10 @@ export var FormDecorator = formType => RenderField => stepAction, situationGate, themeColours, - step: { title }, - fieldName + step: { title, dottedName }, + fieldName, + fieldTitle } = this.props - let inversionTitle = R.path(['props', 'step', 'inversion', 'title'])(this) let answer = situationGate(fieldName) @@ -155,13 +155,13 @@ export var FormDecorator = formType => RenderField =>
- {capitalise0(inversionTitle || title)} + {capitalise0(fieldTitle || title)} {answer}