diff options
| author | Thomas Haddad | 2017-04-14 11:18:02 +0200 |
|---|---|---|
| committer | Thomas Haddad | 2017-04-14 11:18:02 +0200 |
| commit | 329487ccefb13b4040399bb50c444b0fe97393d4 (patch) | |
| tree | e574ed0895cd15ffa1659f8208e7ddb4dab293f8 /app/assets/javascripts | |
| parent | 9b712c6400a3f99413f47ac4b391686aa3000320 (diff) | |
| download | chouette-core-329487ccefb13b4040399bb50c444b0fe97393d4.tar.bz2 | |
Refs #2893: add UPDATE_COMMENT action to tt metas
Signed-off-by: Thomas Shawarma Haddad <thomas.haddad@af83.com>
Diffstat (limited to 'app/assets/javascripts')
4 files changed, 11 insertions, 1 deletions
diff --git a/app/assets/javascripts/es6_browserified/time_tables/actions/index.js b/app/assets/javascripts/es6_browserified/time_tables/actions/index.js index d6c1e2ed1..4dac1906a 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/actions/index.js +++ b/app/assets/javascripts/es6_browserified/time_tables/actions/index.js @@ -18,6 +18,10 @@ const actions = { type: 'UPDATE_DAY_TYPES', index }), + updateComment: (comment) => ({ + type: 'UPDATE_COMMENT', + comment + }), fetchTimeTables: (dispatch, currentPage, nextPage) => { let urlJSON = window.location.pathname.split('/', 5).join('/') + '.json' diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/Metas.js b/app/assets/javascripts/es6_browserified/time_tables/components/Metas.js index 741c1faac..3edc86ae0 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/components/Metas.js +++ b/app/assets/javascripts/es6_browserified/time_tables/components/Metas.js @@ -2,7 +2,7 @@ var React = require('react') var PropTypes = require('react').PropTypes let weekDays = ['D', 'L', 'Ma', 'Me', 'J', 'V', 'S'] -const Metas = ({metas, onUpdateDayTypes}) => { +const Metas = ({metas, onUpdateDayTypes, onUpdateComment}) => { let colorList = ["", "#9B9B9B", "#FFA070", "#C67300", "#7F551B", "#41CCE3", "#09B09C", "#3655D7", "#6321A0", "#E796C6", "#DD2DAA"] return ( <div className="row"> @@ -20,6 +20,7 @@ const Metas = ({metas, onUpdateDayTypes}) => { type='text' className='form-control' value={metas.comment} + onChange={(e) => (onUpdateComment(e.currentTarget.value))} /> </div> </div> diff --git a/app/assets/javascripts/es6_browserified/time_tables/containers/Metas.js b/app/assets/javascripts/es6_browserified/time_tables/containers/Metas.js index d95f744b6..680150c01 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/containers/Metas.js +++ b/app/assets/javascripts/es6_browserified/time_tables/containers/Metas.js @@ -12,6 +12,9 @@ const mapDispatchToProps = (dispatch) => { return { onUpdateDayTypes: (index) => { dispatch(actions.updateDayTypes(index)) + }, + onUpdateComment: (comment) => { + dispatch(actions.updateComment(comment)) } } } diff --git a/app/assets/javascripts/es6_browserified/time_tables/reducers/metas.js b/app/assets/javascripts/es6_browserified/time_tables/reducers/metas.js index 5286c72dc..b2bd20ea1 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/reducers/metas.js +++ b/app/assets/javascripts/es6_browserified/time_tables/reducers/metas.js @@ -14,6 +14,8 @@ const metas = (state = {}, action) => { let dayTypes = state.day_types.slice(0) dayTypes[action.index] = !dayTypes[action.index] return _.assign({}, state, {day_types: dayTypes}) + case 'UPDATE_COMMENT': + return _.assign({}, state, {comment: action.comment}) default: return state } |
