var BS, CCDashboardStore, ChapterSection, DashboardChapter, React, Section, _, classnames;
_ = require('underscore');
React = require('react');
BS = require('react-bootstrap');
classnames = require('classnames');
CCDashboardStore = require('../../flux/cc-dashboard').CCDashboardStore;
ChapterSection = require('../task-plan/chapter-section');
Section = require('./section');
DashboardChapter = React.createClass({displayName: "DashboardChapter",
propTypes: {
chapter: React.PropTypes.shape({
id: React.PropTypes.string,
chapter_section: React.PropTypes.array,
valid_sections: React.PropTypes.array
})
},
renderSections: function() {
return _.map(this.props.chapter.valid_sections, function(section, index) {
return React.createElement(Section, {
"section": section,
"key": index
});
});
},
render: function() {
var classes;
classes = classnames('chapter', {
empty: this.props.chapter.valid_sections
});
return React.createElement("div", {
"className": classes
}, React.createElement(BS.Row, {
"className": "name",
"key": this.props.chapter.id
}, React.createElement(BS.Col, {
"xs": 12.
}, React.createElement(ChapterSection, {
"section": this.props.chapter.chapter_section
}), this.props.chapter.title)), this.renderSections());
}
});
module.exports = DashboardChapter;
|