diff options
| author | jpl | 2017-04-19 16:00:42 +0200 |
|---|---|---|
| committer | jpl | 2017-04-19 16:00:48 +0200 |
| commit | 940bf02a229dadf5d96465278fb38d66e8f76ca8 (patch) | |
| tree | 78c0b8bf14c3528ea6752c3252a3c30f29ebb1de /app/assets/javascripts | |
| parent | fae235f1c8edcd0c03af4da877615799222b509e (diff) | |
| download | chouette-core-940bf02a229dadf5d96465278fb38d66e8f76ca8.tar.bz2 | |
Refs #2982: adding periode_range to PeriodManager display
Diffstat (limited to 'app/assets/javascripts')
| -rw-r--r-- | app/assets/javascripts/es6_browserified/time_tables/actions/index.js | 12 | ||||
| -rw-r--r-- | app/assets/javascripts/es6_browserified/time_tables/components/PeriodManager.js | 8 |
2 files changed, 18 insertions, 2 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 1a6b7d197..a023360a5 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/actions/index.js +++ b/app/assets/javascripts/es6_browserified/time_tables/actions/index.js @@ -68,6 +68,18 @@ const actions = { var date = new Date(strDate) return monthList[date.getMonth()] }, + getHumanDate(strDate, mLimit) { + let origin = strDate.split('-') + let D = origin[2] + let M = actions.monthName(strDate).toLowerCase() + let Y = origin[0] + + if(mLimit) { + M = M.substr(0, mLimit) + '.' + } + + return (D + ' ' + M + ' ' + Y) + }, updateSynthesis: (state, daytypes) => { let periods = state.time_table_periods diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/PeriodManager.js b/app/assets/javascripts/es6_browserified/time_tables/components/PeriodManager.js index 35ceaabd2..61098d9ea 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/components/PeriodManager.js +++ b/app/assets/javascripts/es6_browserified/time_tables/components/PeriodManager.js @@ -1,6 +1,7 @@ var React = require('react') var Component = require('react').Component var PropTypes = require('react').PropTypes +var actions = require('../actions') class PeriodManager extends Component { constructor(props) { @@ -9,8 +10,11 @@ class PeriodManager extends Component { render() { return ( - <div> - P + <div + className='period_manager' + id={this.props.value.id} + > + <strong>{(this.props.value.period_start.split('-')[2]) + ' > ' + actions.getHumanDate(this.props.value.period_end, 3)}</strong> </div> ) } |
