| 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 | 2×
2×
2×
2×
2×
2×
2×
2×
2×
2×
4×
2×
3×
3×
3×
3×
3×
3×
3×
4×
4×
4×
4×
4×
4×
4×
3×
4×
4×
4×
4×
4×
4×
4×
2×
| var BS, CoursePlanDetails, EventModalShell, LoadableItem, React, Router, StatsModalShell, camelCase, classnames;
camelCase = require('camelcase');
classnames = require('classnames');
React = require('react');
BS = require('react-bootstrap');
Router = require('react-router');
StatsModalShell = require('../plan-stats').StatsModalShell;
EventModalShell = require('../plan-stats/event').EventModalShell;
LoadableItem = require('../loadable-item');
CoursePlanDetails = React.createClass({
displayName: 'CoursePlanDetails',
getInitialState: function() {
return {
keepVisible: false
};
},
getDefaultProps: function() {
return {
hasReview: false
};
},
propTypes: {
plan: React.PropTypes.shape({
id: React.PropTypes.string.isRequired,
title: React.PropTypes.string.isRequired,
type: React.PropTypes.string.isRequired
}).isRequired,
courseId: React.PropTypes.string.isRequired,
onRequestHide: React.PropTypes.func.isRequired,
hasReview: React.PropTypes.bool
},
renderReviewButton: function() {
var courseId, id, linkParams, plan, ref, reviewButton, type;
ref = this.props, plan = ref.plan, courseId = ref.courseId;
type = plan.type, id = plan.id;
linkParams = {
courseId: courseId,
id: id
};
reviewButton = React.createElement(Router.Link, {
"className": 'btn btn-default',
"to": 'reviewTask',
"params": linkParams
}, "Review Metrics");
Iif (type === 'external') {
reviewButton = React.createElement(Router.Link, {
"className": 'btn btn-default -view-scores',
"to": 'viewScores',
"params": linkParams
}, "View Scores");
}
return reviewButton;
},
componentWillReceiveProps: function(nextProps) {
return this.setState({
keepVisible: true
});
},
render: function() {
var assignmentOrEvent, body, className, classes, courseId, editButton, editLinkName, footer, hasReview, id, isPublished, isPublishing, keepVisible, linkParams, plan, ref, reviewButton, title, type, viewOrEdit;
ref = this.props, plan = ref.plan, courseId = ref.courseId, className = ref.className, isPublishing = ref.isPublishing, isPublished = ref.isPublished, hasReview = ref.hasReview;
title = plan.title, type = plan.type, id = plan.id;
linkParams = {
courseId: courseId,
id: id
};
keepVisible = this.state.keepVisible;
Iif (!(isPublishing || isPublished)) {
return null;
}
if (hasReview) {
reviewButton = this.renderReviewButton();
}
editLinkName = camelCase("edit-" + type);
viewOrEdit = plan.isEditable ? 'Edit' : 'View';
assignmentOrEvent = type === 'event' ? 'Event' : 'Assignment';
editButton = React.createElement(Router.Link, {
"className": 'btn btn-default -edit-assignment',
"to": editLinkName,
"params": linkParams
}, viewOrEdit, " ", assignmentOrEvent);
body = isPublished ? (footer = React.createElement("div", {
"className": 'modal-footer'
}, reviewButton, editButton), type === 'event' ? React.createElement(EventModalShell, {
"id": id,
"courseId": courseId
}) : React.createElement(StatsModalShell, {
"id": id,
"courseId": courseId
})) : isPublishing ? React.createElement("p", null, "This plan is publishing.") : void 0;
classes = classnames('plan-modal', className, {
'in': keepVisible
});
return React.createElement(BS.Modal, React.__spread({}, this.props, {
"title": title,
"data-assignment-type": type,
"className": classes
}), React.createElement("div", {
"className": 'modal-body'
}, body), footer);
}
});
module.exports = CoursePlanDetails;
|