aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/assets/javascripts/es6_browserified/time_tables/actions/index.js5
-rw-r--r--app/assets/javascripts/es6_browserified/time_tables/components/PeriodManager.js2
-rw-r--r--app/assets/javascripts/es6_browserified/time_tables/containers/Timetable.js4
-rw-r--r--app/assets/javascripts/es6_browserified/time_tables/reducers/modal.js3
4 files changed, 8 insertions, 6 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 0970e400d..a9fbb94cf 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/actions/index.js
+++ b/app/assets/javascripts/es6_browserified/time_tables/actions/index.js
@@ -71,9 +71,10 @@ const actions = {
openAddPeriodForm: () => ({
type: 'OPEN_ADD_PERIOD_FORM'
}),
- openEditPeriodForm: (period) => ({
+ openEditPeriodForm: (period, index) => ({
type: 'OPEN_EDIT_PERIOD_FORM',
- period
+ period,
+ index
}),
closePeriodForm: () => ({
type: 'CLOSE_PERIOD_FORM'
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 bbda6b201..de3f31ee0 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/components/PeriodManager.js
+++ b/app/assets/javascripts/es6_browserified/time_tables/components/PeriodManager.js
@@ -35,7 +35,7 @@ class PeriodManager extends Component {
<li>
<button
type='button'
- onClick={() => this.props.onOpenEditPeriodForm(this.props.value)}
+ onClick={() => this.props.onOpenEditPeriodForm(this.props.value, this.props.index)}
>
Modifier
</button>
diff --git a/app/assets/javascripts/es6_browserified/time_tables/containers/Timetable.js b/app/assets/javascripts/es6_browserified/time_tables/containers/Timetable.js
index a5d3aa555..2a17d3dea 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/containers/Timetable.js
+++ b/app/assets/javascripts/es6_browserified/time_tables/containers/Timetable.js
@@ -21,8 +21,8 @@ const mapDispatchToProps = (dispatch) => {
onIncludeDateInPeriod: (index, day, dayTypes) => {
dispatch(actions.includeDateInPeriod(index, day, dayTypes))
},
- onOpenEditPeriodForm: (period) => {
- dispatch(actions.openEditPeriodForm(period))
+ onOpenEditPeriodForm: (period, index) => {
+ dispatch(actions.openEditPeriodForm(period, index))
}
}
}
diff --git a/app/assets/javascripts/es6_browserified/time_tables/reducers/modal.js b/app/assets/javascripts/es6_browserified/time_tables/reducers/modal.js
index a41f79d82..e9c0c2fb9 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/reducers/modal.js
+++ b/app/assets/javascripts/es6_browserified/time_tables/reducers/modal.js
@@ -9,7 +9,7 @@ const modal = (state = {}, action) => {
month: '',
year: ''
}
- newModalProps = _.assign({}, state.modalProps, {active: false, begin: emptyDate, end: emptyDate})
+ newModalProps = _.assign({}, state.modalProps, {active: false, begin: emptyDate, end: emptyDate, index: false})
return _.assign({}, state, {modalProps: newModalProps})
case 'OPEN_EDIT_PERIOD_FORM':
let period_start = action.period.period_start.split('-')
@@ -25,6 +25,7 @@ const modal = (state = {}, action) => {
newModalProps.end.day = period_end[2]
newModalProps.active = true
+ newModalProps.index = action.index
return _.assign({}, state, {modalProps: newModalProps})
case 'OPEN_ADD_PERIOD_FORM':
newModalProps = _.assign({}, state.modalProps, {active: true})