From bd299d5724ce4cb7a224e9dabfe55daa400d9d01 Mon Sep 17 00:00:00 2001 From: Mael Thomas Date: Mon, 13 Feb 2017 16:20:26 +0100 Subject: [PATCH] =?UTF-8?q?[CDD]=20Ajout=20et=20mise=20en=20=C3=A9vidence?= =?UTF-8?q?=20du=20choix=20'Aucun'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/components/CDD.css | 4 ++-- source/components/HoverDecorator.js | 6 +++--- source/components/conversation/Explicable.css | 2 +- source/components/conversation/FormDecorator.js | 12 ------------ source/components/conversation/Question.js | 5 +++-- source/components/conversation/conversation.css | 14 +++++++++++--- source/reducers.js | 10 ++++------ 7 files changed, 24 insertions(+), 29 deletions(-) diff --git a/source/components/CDD.css b/source/components/CDD.css index 109c2c734..f0bc21f03 100644 --- a/source/components/CDD.css +++ b/source/components/CDD.css @@ -104,12 +104,12 @@ /*width: 80%;*/ border-bottom: 1px solid #aaa; margin: .1em; - margin-bottom: 1em; + margin-bottom: .3em; padding-bottom: .2em; } #results li p { - margin-top: 0; + margin: 0; font-size: 150%; } diff --git a/source/components/HoverDecorator.js b/source/components/HoverDecorator.js index 2d192285d..8b140f6f0 100644 --- a/source/components/HoverDecorator.js +++ b/source/components/HoverDecorator.js @@ -5,10 +5,10 @@ export default DecoratedComponent => state = { hover: false, } - toggleHover = () => - this.setState({hover: !this.state.hover}) + setHover = state => () => + this.setState({hover: state}) render() { - return + return } diff --git a/source/components/conversation/Explicable.css b/source/components/conversation/Explicable.css index 1637c22ec..7f8df6087 100644 --- a/source/components/conversation/Explicable.css +++ b/source/components/conversation/Explicable.css @@ -33,7 +33,7 @@ background: #4A89DC; color: white; } -.explicable.explained .icon { +.explicable.dark.explained .icon { background: #222; color: white; } diff --git a/source/components/conversation/FormDecorator.js b/source/components/conversation/FormDecorator.js index cdc1b24c6..314a00893 100644 --- a/source/components/conversation/FormDecorator.js +++ b/source/components/conversation/FormDecorator.js @@ -3,7 +3,6 @@ import classNames from 'classnames' import { connect } from 'react-redux' import {Field, change} from 'redux-form' import {stepAction} from '../../actions' -import IgnoreStepButton from './IgnoreStepButton' import StepAnswer from './StepAnswer' /* @@ -40,7 +39,6 @@ export var FormDecorator = formType => RenderField => themeColours, // formerly in conversation-steps valueType, - defaultValue, attributes, choices, optionsURL, @@ -50,13 +48,6 @@ export var FormDecorator = formType => RenderField => this.step = steps.find(s => s.name == name) - let ignoreStep = () => { - // Renseigne automatiquement la valeur de la saisie (en se plongeant dans les entrailles de redux-form) - this.props.setFormValue(name, defaultValue) - stepAction(name, 'ignored') - } - - /* La saisie peut être cachée car ce n'est pas encore son tour, ou parce qu'elle a déjà été remplie. Dans ce dernier cas, un résumé de la réponse est affiché */ @@ -91,9 +82,6 @@ export var FormDecorator = formType => RenderField => {this.renderHeader(unfolded, valueType, human, helpText, wideQuestion)} {unfolded &&
- { defaultValue && - - } +
{ choices.map((choice) => do { let {value, label} = R.is(String)(choice) ? {value: choice, label: null} : choice; } )} - +
) } } diff --git a/source/components/conversation/conversation.css b/source/components/conversation/conversation.css index 217cf38e8..7bce8a3b0 100644 --- a/source/components/conversation/conversation.css +++ b/source/components/conversation/conversation.css @@ -127,6 +127,16 @@ question : make it visible with colors */ margin: .8em 0; } +.step.question fieldset > div { + display: flex; + justify-content: flex-end; + flex-wrap: wrap; +} + +.step.question fieldset span { + margin-bottom: .6em; +} + .step label.radio, /* A resume of what's been answered */ .resume { @@ -138,7 +148,6 @@ question : make it visible with colors */ padding: 0 .8em; line-height: 1.8em; border-radius: 1em; - float: right; } .step label.radio { @@ -147,10 +156,9 @@ question : make it visible with colors */ margin-top: 1em; cursor: pointer; background: none; - padding: .2em 1em; + padding: .3em 1em; line-height: 1.8em; border-radius: .4em; - float: right; font-weight: 600; font-size: 90%; border: 1px solid #ddd; diff --git a/source/reducers.js b/source/reducers.js index 77e424655..223716ade 100644 --- a/source/reducers.js +++ b/source/reducers.js @@ -107,7 +107,6 @@ export default reduceReducers( rule.format == 'période' ? { component: Input, - defaultValue: 1, valueType: euro, attributes: { inputMode: 'numeric', @@ -118,8 +117,7 @@ export default reduceReducers( choices: [ {value: 'non', label: 'Non'}, {value: 'oui', label: 'Oui'} - ], - defaultValue: 'Non', + ] } )})], [R.T, group => @@ -129,9 +127,9 @@ export default reduceReducers( component: Question, choices: group['une possibilité'].concat( - [{value: 'aucun', label: 'Aucun'}] - ), - // defaultValue: 'Non', + group.requis !== 'oui' ? + [{value: '_', label: 'Aucun'}] : [] + ) } )] ])