[CDD] Ajout et mise en évidence du choix 'Aucun'

pull/6/head
Mael Thomas 2017-02-13 16:20:26 +01:00
parent 9ccc05be77
commit bd299d5724
7 changed files with 24 additions and 29 deletions

View File

@ -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%;
}

View File

@ -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 <span onMouseEnter={this.toggleHover} onMouseLeave={this.toggleHover} >
return <span onMouseEnter={this.setHover(true)} onMouseLeave={this.setHover(false)} >
<DecoratedComponent {...this.props} hover={this.state.hover}/>
</span>
}

View File

@ -33,7 +33,7 @@
background: #4A89DC;
color: white;
}
.explicable.explained .icon {
.explicable.dark.explained .icon {
background: #222;
color: white;
}

View File

@ -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 &&
<fieldset>
{ defaultValue &&
<IgnoreStepButton name={name} action={ignoreStep}/>
}
<Field
component={RenderField}
name={name}

View File

@ -14,6 +14,7 @@ class RadioLabel extends Component {
labelStyle =
Object.assign(
(value === input.value || hover) ? answered(themeColours) : answer(themeColours),
value === '_' ? {fontWeight: 'bold'} : null
)
return (
@ -42,13 +43,13 @@ export default class Question extends Component {
} = this.props
return (
<span>
<div>
{ choices.map((choice) => do {
let {value, label} = R.is(String)(choice) ? {value: choice, label: null} : choice;
<RadioLabel key={value} {...{value, label, input, submit, themeColours}}/>
}
)}
</span>
</div>
)
}
}

View File

@ -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;

View File

@ -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'}] : []
)
}
)]
])