| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196 | 2×
2×
2×
2×
2×
2×
2×
2×
2×
2×
2×
2×
2×
2×
2×
2×
3×
3×
3×
3×
3×
3×
3×
3×
3×
3×
3×
2×
12×
12×
12×
12×
12×
12×
12×
12×
12×
12×
3×
12×
2×
12×
3×
12×
1×
1×
1×
1×
12×
12×
11×
12×
2×
12×
2×
| var AddExercises, BS, ChooseExercises, ExerciseSummary, ExerciseTable, HomeworkPlan, PinnedHeaderFooterCard, PlanFooter, PlanMixin, React, ReviewExercises, Router, SelectTopics, TaskPlanActions, TaskPlanBuilder, TaskPlanStore, TutorDateInput, TutorInput, TutorTextArea, _, moment, ref, ref1, ref2;
React = require('react');
moment = require('moment');
_ = require('underscore');
BS = require('react-bootstrap');
Router = require('react-router');
PlanFooter = require('./footer');
SelectTopics = require('./select-topics');
ExerciseSummary = require('./homework/exercise-summary');
PlanMixin = require('./plan-mixin');
PinnedHeaderFooterCard = require('openstax-react-components').PinnedHeaderFooterCard;
TaskPlanBuilder = require('./builder');
ref = require('../tutor-input'), TutorInput = ref.TutorInput, TutorDateInput = ref.TutorDateInput, TutorTextArea = ref.TutorTextArea;
ref1 = require('./homework/exercises'), AddExercises = ref1.AddExercises, ReviewExercises = ref1.ReviewExercises, ExerciseTable = ref1.ExerciseTable;
ref2 = require('../../flux/task-plan'), TaskPlanStore = ref2.TaskPlanStore, TaskPlanActions = ref2.TaskPlanActions;
ChooseExercises = React.createClass({
displayName: 'ChooseExercises',
propTypes: {
planId: React.PropTypes.string.isRequired,
courseId: React.PropTypes.string.isRequired,
selected: React.PropTypes.array.isRequired,
hide: React.PropTypes.func.isRequired,
canEdit: React.PropTypes.bool
},
selectProblems: function() {
return this.setState({
showProblems: true
});
},
render: function() {
var addExercises, cancel, classes, courseId, ecosystemId, exerciseSummary, header, hide, planId, primary, ref3, ref4, ref5, selected, shouldShowExercises;
ref3 = this.props, courseId = ref3.courseId, planId = ref3.planId, ecosystemId = ref3.ecosystemId, selected = ref3.selected, hide = ref3.hide, cancel = ref3.cancel;
header = React.createElement("span", null, "Add Problems");
selected = TaskPlanStore.getTopics(planId);
shouldShowExercises = ((ref4 = this.props.selected) != null ? ref4.length : void 0) && ((ref5 = this.state) != null ? ref5.showProblems : void 0);
classes = ['-show-problems'];
Iif (!(selected != null ? selected.length : void 0)) {
classes.push('disabled');
}
classes = classes.join(' ');
primary = React.createElement(BS.Button, {
"className": classes,
"bsStyle": 'primary',
"onClick": this.selectProblems
}, "Show Problems");
Iif (shouldShowExercises) {
exerciseSummary = React.createElement(ExerciseSummary, {
"canReview": true,
"canEdit": this.props.canEdit,
"reviewClicked": hide,
"onCancel": cancel,
"planId": planId
});
addExercises = React.createElement(AddExercises, {
"courseId": courseId,
"planId": planId,
"pageIds": selected
});
}
return React.createElement("div", {
"className": 'homework-plan-exercise-select-topics'
}, React.createElement(SelectTopics, {
"primary": primary,
"header": header,
"courseId": courseId,
"ecosystemId": ecosystemId,
"planId": planId,
"selected": selected,
"cancel": cancel,
"hide": hide
}), React.createElement(PinnedHeaderFooterCard, {
"containerBuffer": 50.,
"header": exerciseSummary,
"cardType": 'homework-builder'
}, addExercises));
}
});
HomeworkPlan = React.createClass({
displayName: 'HomeworkPlan',
mixins: [PlanMixin],
render: function() {
var addProblemsButton, chooseExercises, courseId, ecosystemId, exerciseSummary, exerciseTable, footer, formClasses, hasExercises, header, id, plan, problemsRequired, ref3, ref4, ref5, ref6, ref7, ref8, reviewExercises, reviewExercisesSummary, shouldShowExercises, topics;
ref3 = this.props, id = ref3.id, courseId = ref3.courseId;
plan = TaskPlanStore.get(id);
ecosystemId = TaskPlanStore.getEcosystemId(id, courseId);
topics = TaskPlanStore.getTopics(id);
hasExercises = (ref4 = TaskPlanStore.getExercises(id)) != null ? ref4.length : void 0;
shouldShowExercises = hasExercises && !((ref5 = this.state) != null ? ref5.showSectionTopics : void 0);
footer = React.createElement(PlanFooter, {
"id": id,
"courseId": courseId,
"onPublish": this.publish,
"onSave": this.save,
"onCancel": this.cancel,
"getBackToCalendarParams": this.getBackToCalendarParams,
"goBackToCalendar": this.goBackToCalendar
});
formClasses = ['edit-homework dialog'];
if ((ref6 = this.state) != null ? ref6.showSectionTopics : void 0) {
formClasses.push('hide');
}
if ((ref7 = this.state) != null ? ref7.invalid : void 0) {
formClasses.push('is-invalid-form');
}
if (this.state.showSectionTopics) {
chooseExercises = React.createElement(ChooseExercises, {
"courseId": courseId,
"planId": id,
"ecosystemId": ecosystemId,
"cancel": this.cancelSelection,
"hide": this.hideSectionTopics,
"canEdit": !this.state.isVisibleToStudents,
"selected": topics
});
}
if (shouldShowExercises) {
exerciseSummary = React.createElement(ExerciseSummary, {
"onCancel": this.cancel,
"onPublish": this.publish,
"canAdd": !this.state.isVisibleToStudents,
"addClicked": this.showSectionTopics,
"planId": id
});
exerciseTable = React.createElement(ExerciseTable, {
"courseId": courseId,
"pageIds": topics,
"planId": id
});
reviewExercises = React.createElement(ReviewExercises, {
"courseId": courseId,
"pageIds": topics,
"canEdit": !this.state.isVisibleToStudents,
"planId": id
});
reviewExercisesSummary = React.createElement(PinnedHeaderFooterCard, {
"containerBuffer": 50.,
"header": exerciseSummary,
"cardType": 'homework-builder'
}, exerciseTable, reviewExercises);
}
header = this.builderHeader('homework');
if (!this.state.isVisibleToStudents) {
addProblemsButton = React.createElement(BS.Button, {
"id": 'problems-select',
"onClick": this.showSectionTopics,
"bsStyle": 'default'
}, "+ Select Problems");
}
if (((ref8 = this.state) != null ? ref8.invalid : void 0) && !hasExercises) {
problemsRequired = React.createElement("span", {
"className": "problems-required"
}, "Please add exercises to this assignment", React.createElement("i", {
"className": "fa fa-exclamation-circle"
}));
}
return React.createElement("div", {
"className": 'homework-plan task-plan',
"data-assignment-type": 'homework'
}, React.createElement(BS.Panel, {
"bsStyle": 'default',
"header": header,
"className": formClasses.join(' '),
"footer": footer
}, React.createElement(BS.Grid, {
"fluid": true
}, React.createElement(TaskPlanBuilder, {
"courseId": courseId,
"id": id
}), React.createElement(BS.Row, null, React.createElement(BS.Col, {
"xs": 12,
"md": 12
}, addProblemsButton, problemsRequired)))), chooseExercises, reviewExercisesSummary);
}
});
module.exports = {
HomeworkPlan: HomeworkPlan
};
|