| 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 | 2×
2×
2×
2×
2×
4×
4×
4×
4×
4×
4×
4×
2×
2×
2×
2×
2×
4×
3×
3×
3×
4×
2×
| var BS, ExerciseSummary, React, TaskPlanActions, TaskPlanStore, ref;
React = require('react');
BS = require('react-bootstrap');
ref = require('../../../flux/task-plan'), TaskPlanStore = ref.TaskPlanStore, TaskPlanActions = ref.TaskPlanActions;
ExerciseSummary = React.createClass({
displayName: 'ExerciseSummary',
propTypes: {
planId: React.PropTypes.string.isRequired,
canAdd: React.PropTypes.bool,
canEdit: React.PropTypes.bool,
canReview: React.PropTypes.bool,
addClicked: React.PropTypes.func,
reviewClicked: React.PropTypes.func
},
addTutorSelection: function() {
return TaskPlanActions.updateTutorSelection(this.props.planId, 1);
},
removeTutorSelection: function() {
return TaskPlanActions.updateTutorSelection(this.props.planId, -1);
},
render: function() {
var addSelection, buttonColumnSize, buttons, explanation, numSelected, numTutor, removeSelection, total;
numSelected = TaskPlanStore.getExercises(this.props.planId).length;
numTutor = TaskPlanStore.getTutorSelections(this.props.planId);
total = numSelected + numTutor;
buttonColumnSize = 2;
explanation = React.createElement(BS.Col, {
"sm": 6.,
"md": 2.,
"className": "tutor-added-later"
}, React.createElement("em", null, "Tutor selections are added later to support spaced practice and personalized learning."));
if (this.props.canReview && numSelected) {
buttons = React.createElement("span", null, React.createElement(BS.Button, {
"bsStyle": "primary",
"className": "-review-exercises",
"onClick": this.props.reviewClicked
}, "Next"), React.createElement(BS.Button, {
"bsStyle": "default",
"className": "-cancel-add",
"onClick": this.props.onCancel
}, "Cancel"));
} else Eif (this.props.canAdd) {
explanation = null;
buttonColumnSize = 4;
buttons = React.createElement(BS.Button, {
"bsStyle": "default",
"className": "-add-exercises",
"onClick": this.props.addClicked
}, "Add More...");
}
if (this.props.canEdit || this.props.canAdd) {
Iif (TaskPlanStore.canDecreaseTutorExercises(this.props.planId)) {
removeSelection = React.createElement(BS.Button, {
"onClick": this.removeTutorSelection,
"className": "btn-xs -move-exercise-down"
}, React.createElement("i", {
"className": "fa fa-arrow-down"
}));
}
Eif (TaskPlanStore.canIncreaseTutorExercises(this.props.planId)) {
addSelection = React.createElement(BS.Button, {
"onClick": this.addTutorSelection,
"className": "btn-xs -move-exercise-up"
}, React.createElement("i", {
"className": "fa fa-arrow-up"
}));
}
}
return React.createElement(BS.Panel, {
"className": "exercise-summary",
"bsStyle": "default"
}, React.createElement(BS.Grid, null, React.createElement(BS.Row, null, React.createElement(BS.Col, {
"sm": 6.,
"md": 2.,
"className": "total"
}, React.createElement("h2", null, total), "Total Problems"), React.createElement(BS.Col, {
"sm": 6.,
"md": 2.,
"className": "num-selected"
}, React.createElement("h2", null, numSelected), "My Selections"), React.createElement(BS.Col, {
"sm": 6.,
"md": 2.,
"className": "num-tutor"
}, React.createElement("div", {
"className": "tutor-selections"
}, removeSelection, React.createElement("h2", null, numTutor), addSelection), "Tutor Selections"), explanation, React.createElement(BS.Col, {
"sm": 6.,
"md": buttonColumnSize
}, buttons), React.createElement(BS.Col, {
"sm": 6.,
"md": 2.
}))));
}
});
module.exports = ExerciseSummary;
|