| 1 |
import Actions from '../actions/course-section'; |
| 2 |
import Mutations from '../mutations/course-section'; |
| 3 |
import Getters from '../getters/course-section'; |
| 4 |
|
| 5 |
const $ = window.jQuery; |
| 6 |
|
| 7 |
export default function( data ) { |
| 8 |
var state = $.extend( {}, data.sections ); |
| 9 |
|
| 10 |
state.statusUpdateSection = {}; |
| 11 |
state.statusUpdateSectionItem = {}; |
| 12 |
|
| 13 |
state.sections = state.sections.map( function( section ) { |
| 14 |
var hiddenSections = state.hidden_sections; |
| 15 |
|
| 16 |
var find = hiddenSections.find( function( sectionId ) { |
| 17 |
return parseInt( section.id ) === parseInt( sectionId ); |
| 18 |
} ); |
| 19 |
|
| 20 |
section.open = ! find; |
| 21 |
|
| 22 |
return section; |
| 23 |
} ); |
| 24 |
|
| 25 |
return { |
| 26 |
namespaced: true, |
| 27 |
state: state, |
| 28 |
getters: Getters, |
| 29 |
mutations: Mutations, |
| 30 |
actions: Actions, |
| 31 |
}; |
| 32 |
} |
| 33 |
|