@instructure/quiz-core 20.10.1-rc.7 → 20.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/es/building/components/layout/header/BuildingButtons/presenter.js +253 -61
- package/es/building/components/layout/header/BuildingButtons/styles.js +8 -4
- package/es/index.js +0 -1
- package/lib/building/components/layout/header/BuildingButtons/presenter.js +255 -61
- package/lib/building/components/layout/header/BuildingButtons/styles.js +10 -4
- package/lib/index.js +62 -73
- package/package.json +10 -10
- package/es/building/components/layout/header/BuildingButtonsICE/index.js +0 -40
- package/es/building/components/layout/header/BuildingButtonsICE/presenter.js +0 -249
- package/lib/building/components/layout/header/BuildingButtonsICE/index.js +0 -65
- package/lib/building/components/layout/header/BuildingButtonsICE/presenter.js +0 -274
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
-
import React, { Component } from 'react';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import { Drilldown } from '@instructure/ui-drilldown';
|
|
8
|
-
import { View } from '@instructure/ui-view';
|
|
9
|
-
import { TopNavBar } from '@instructure/ui-top-nav-bar';
|
|
10
|
-
import { IconExportLine, IconImportLine, IconBankLine, IconPrinterLine, IconSpeedGraderLine } from '@instructure/ui-icons';
|
|
11
|
-
import PrintTrigger from "../../../../../common/components/shared/PrintTrigger/index.js";
|
|
12
|
-
import { PRINT_CURRENT_PAGE, PRINT_BLANK } from '@instructure/quiz-common';
|
|
13
|
-
import t from '@instructure/quiz-i18n/es/format-message';
|
|
14
|
-
|
|
15
|
-
var _ref = /*#__PURE__*/React.createElement(IconSpeedGraderLine, null);
|
|
16
|
-
|
|
17
|
-
var _ref2 = /*#__PURE__*/React.createElement(IconImportLine, {
|
|
18
|
-
"data-automation": "sdk-import-content-icon"
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
var _ref3 = /*#__PURE__*/React.createElement(IconExportLine, {
|
|
22
|
-
"data-automation": "sdk-export-content-icon"
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
var _ref4 = /*#__PURE__*/React.createElement(IconBankLine, {
|
|
26
|
-
"data-automation": "sdk-manage-item-banks-icon"
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
var _ref5 = /*#__PURE__*/React.createElement(IconPrinterLine, {
|
|
30
|
-
"data-automation": "sdk-print-icon"
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
var _ref6 = /*#__PURE__*/React.createElement(IconPrinterLine, {
|
|
34
|
-
"data-automation": "sdk-print-blank-icon"
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
export var BuildingButtonsICE = /*#__PURE__*/function (_Component) {
|
|
38
|
-
_inherits(BuildingButtonsICE, _Component);
|
|
39
|
-
|
|
40
|
-
var _super = _createSuper(BuildingButtonsICE);
|
|
41
|
-
|
|
42
|
-
function BuildingButtonsICE() {
|
|
43
|
-
var _this;
|
|
44
|
-
|
|
45
|
-
_classCallCheck(this, BuildingButtonsICE);
|
|
46
|
-
|
|
47
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
48
|
-
args[_key] = arguments[_key];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
52
|
-
|
|
53
|
-
_this.quizExportAlert = function () {
|
|
54
|
-
_this.props.addInfo(t("The export process has been started. This can take a while for larger quizzes.\n You can leave the page and you'll get notified when the export is completed."));
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
_this.openBanksTray = function () {
|
|
58
|
-
_this.props.setBanksTrayButtonRef(_this.banksTrayButton);
|
|
59
|
-
|
|
60
|
-
_this.props.openBanksTray();
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
_this.openSpeedgraderLink = function () {
|
|
64
|
-
window.open(_this.props.speedgraderLink, '_blank');
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
_this.startQuizExportJob = function () {
|
|
68
|
-
if (_this.props.canExport) {
|
|
69
|
-
var _this$props = _this.props,
|
|
70
|
-
activeQuizId = _this$props.activeQuizId,
|
|
71
|
-
contextUuid = _this$props.contextUuid;
|
|
72
|
-
var exportSettings = {
|
|
73
|
-
export_type: 'qti',
|
|
74
|
-
everything: false,
|
|
75
|
-
quizzes: [activeQuizId]
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
_this.quizExportAlert();
|
|
79
|
-
|
|
80
|
-
_this.props.contentExport({
|
|
81
|
-
contextUuid: contextUuid,
|
|
82
|
-
exportSettings: exportSettings
|
|
83
|
-
}, _this.props.addAlert);
|
|
84
|
-
|
|
85
|
-
_this.props.startExport(activeQuizId);
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
return _this;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
_createClass(BuildingButtonsICE, [{
|
|
93
|
-
key: "isBuildingPage",
|
|
94
|
-
value: function isBuildingPage() {
|
|
95
|
-
return 'building' === this.props.app;
|
|
96
|
-
}
|
|
97
|
-
}, {
|
|
98
|
-
key: "renderOptions",
|
|
99
|
-
value: function renderOptions(handlePrint) {
|
|
100
|
-
if (!this.isBuildingPage()) return;
|
|
101
|
-
var options = [];
|
|
102
|
-
|
|
103
|
-
if (this.props.speedgraderLink) {
|
|
104
|
-
options.push( /*#__PURE__*/React.createElement(Drilldown.Option, {
|
|
105
|
-
id: "speedgrader",
|
|
106
|
-
key: "speedgrader",
|
|
107
|
-
onOptionClick: this.openSpeedgraderLink
|
|
108
|
-
}, _ref, /*#__PURE__*/React.createElement(View, {
|
|
109
|
-
as: "span",
|
|
110
|
-
margin: "0 0 0 x-small"
|
|
111
|
-
}, t('Speedgrader'))));
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
options.push( /*#__PURE__*/React.createElement(Drilldown.Option, {
|
|
115
|
-
id: "import",
|
|
116
|
-
key: "import",
|
|
117
|
-
disabled: !this.props.canImport,
|
|
118
|
-
onOptionClick: this.props.openModal,
|
|
119
|
-
"data-automation": "sdk-import-content-menuitem"
|
|
120
|
-
}, _ref2, /*#__PURE__*/React.createElement(View, {
|
|
121
|
-
as: "span",
|
|
122
|
-
margin: "0 0 0 x-small"
|
|
123
|
-
}, t('Import Content'))));
|
|
124
|
-
|
|
125
|
-
if (this.props.contentExportEnabled) {
|
|
126
|
-
options.push( /*#__PURE__*/React.createElement(Drilldown.Option, {
|
|
127
|
-
id: "export",
|
|
128
|
-
key: "export",
|
|
129
|
-
disabled: !this.props.canExport,
|
|
130
|
-
onOptionClick: this.startQuizExportJob,
|
|
131
|
-
"data-automation": "sdk-export-content-menuitem"
|
|
132
|
-
}, _ref3, /*#__PURE__*/React.createElement(View, {
|
|
133
|
-
as: "span",
|
|
134
|
-
margin: "0 0 0 x-small"
|
|
135
|
-
}, t('Export Content'))));
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (this.props.enableItemBanking) {
|
|
139
|
-
options.push( /*#__PURE__*/React.createElement(Drilldown.Option, {
|
|
140
|
-
id: "banks",
|
|
141
|
-
key: "banks",
|
|
142
|
-
onOptionClick: this.props.navigateToBanks,
|
|
143
|
-
"data-automation": "sdk-manage-item-banks-menuitem"
|
|
144
|
-
}, _ref4, /*#__PURE__*/React.createElement(View, {
|
|
145
|
-
as: "span",
|
|
146
|
-
margin: "0 0 0 x-small"
|
|
147
|
-
}, t('Manage Item Banks'))));
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
if (this.props.printingEnabled) {
|
|
151
|
-
{
|
|
152
|
-
/* eslint-disable react/jsx-no-bind */
|
|
153
|
-
}
|
|
154
|
-
options.push( /*#__PURE__*/React.createElement(Drilldown.Option, {
|
|
155
|
-
id: "printKey",
|
|
156
|
-
key: "printKey",
|
|
157
|
-
disabled: !this.props.hasQuestions || this.props.isEditing,
|
|
158
|
-
onOptionClick: function onOptionClick() {
|
|
159
|
-
return handlePrint(PRINT_CURRENT_PAGE);
|
|
160
|
-
},
|
|
161
|
-
"data-automation": "sdk-print-key-menuitem"
|
|
162
|
-
}, _ref5, /*#__PURE__*/React.createElement(View, {
|
|
163
|
-
as: "span",
|
|
164
|
-
margin: "0 0 0 x-small"
|
|
165
|
-
}, t('Print Key (With Answers)'))));
|
|
166
|
-
options.push( /*#__PURE__*/React.createElement(Drilldown.Option, {
|
|
167
|
-
id: "printBlank",
|
|
168
|
-
key: "printBlank",
|
|
169
|
-
disabled: !this.props.hasQuestions || this.props.isEditing,
|
|
170
|
-
onOptionClick: function onOptionClick() {
|
|
171
|
-
return handlePrint(PRINT_BLANK);
|
|
172
|
-
},
|
|
173
|
-
"data-automation": "sdk-print-blank-menuitem"
|
|
174
|
-
}, _ref6, /*#__PURE__*/React.createElement(View, {
|
|
175
|
-
as: "span",
|
|
176
|
-
margin: "0 0 0 x-small"
|
|
177
|
-
}, t('Print Blank Quiz'))));
|
|
178
|
-
{
|
|
179
|
-
/* eslint-enable react/jsx-no-bind */
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
if (options.length < 1) return;
|
|
184
|
-
return /*#__PURE__*/React.createElement(TopNavBar.Item, {
|
|
185
|
-
id: this.props.id,
|
|
186
|
-
variant: "icon",
|
|
187
|
-
renderIcon: this.props.renderIcon,
|
|
188
|
-
showSubmenuChevron: false,
|
|
189
|
-
renderSubmenu: /*#__PURE__*/React.createElement(Drilldown, {
|
|
190
|
-
rootPageId: "root"
|
|
191
|
-
}, /*#__PURE__*/React.createElement(Drilldown.Page, {
|
|
192
|
-
id: "root"
|
|
193
|
-
}, options))
|
|
194
|
-
}, t('More'));
|
|
195
|
-
}
|
|
196
|
-
}, {
|
|
197
|
-
key: "render",
|
|
198
|
-
value: function render() {
|
|
199
|
-
var _this2 = this;
|
|
200
|
-
|
|
201
|
-
/* eslint-disable react/jsx-no-bind */
|
|
202
|
-
return /*#__PURE__*/React.createElement(PrintTrigger, {
|
|
203
|
-
render: function render(handlePrint) {
|
|
204
|
-
return _this2.renderOptions(handlePrint);
|
|
205
|
-
},
|
|
206
|
-
navigateToPreviewPrint: this.props.navigateToPreviewPrint
|
|
207
|
-
});
|
|
208
|
-
/* eslint-enable react/jsx-no-bind */
|
|
209
|
-
}
|
|
210
|
-
}]);
|
|
211
|
-
|
|
212
|
-
BuildingButtonsICE.displayName = "BuildingButtonsICE";
|
|
213
|
-
return BuildingButtonsICE;
|
|
214
|
-
}(Component);
|
|
215
|
-
BuildingButtonsICE.propTypes = {
|
|
216
|
-
id: PropTypes.string.isRequired,
|
|
217
|
-
renderIcon: PropTypes.element.isRequired,
|
|
218
|
-
app: PropTypes.string,
|
|
219
|
-
addAlert: PropTypes.func.isRequired,
|
|
220
|
-
addInfo: PropTypes.func,
|
|
221
|
-
activeQuizId: PropTypes.string,
|
|
222
|
-
canExport: PropTypes.bool.isRequired,
|
|
223
|
-
canImport: PropTypes.bool.isRequired,
|
|
224
|
-
contentExportEnabled: PropTypes.bool,
|
|
225
|
-
contentExport: PropTypes.func,
|
|
226
|
-
enableItemBanking: PropTypes.bool,
|
|
227
|
-
hasQuestions: PropTypes.bool.isRequired,
|
|
228
|
-
isEditing: PropTypes.bool.isRequired,
|
|
229
|
-
navigateToBanks: PropTypes.func.isRequired,
|
|
230
|
-
navigateToPreviewPrint: PropTypes.func.isRequired,
|
|
231
|
-
openBanksTray: PropTypes.func.isRequired,
|
|
232
|
-
openModal: PropTypes.func.isRequired,
|
|
233
|
-
printingEnabled: PropTypes.bool.isRequired,
|
|
234
|
-
setBanksTrayButtonRef: PropTypes.func.isRequired,
|
|
235
|
-
speedgraderLink: PropTypes.string,
|
|
236
|
-
startExport: PropTypes.func.isRequired,
|
|
237
|
-
contextUuid: PropTypes.string
|
|
238
|
-
};
|
|
239
|
-
BuildingButtonsICE.defaultProps = {
|
|
240
|
-
activeQuizId: null,
|
|
241
|
-
addInfo: function addInfo() {},
|
|
242
|
-
app: null,
|
|
243
|
-
contentExportEnabled: false,
|
|
244
|
-
contentExport: null,
|
|
245
|
-
enableItemBanking: true,
|
|
246
|
-
speedgraderLink: null,
|
|
247
|
-
contextUuid: null
|
|
248
|
-
};
|
|
249
|
-
export default BuildingButtonsICE;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports.mapStateToProps = mapStateToProps;
|
|
11
|
-
exports.default = void 0;
|
|
12
|
-
|
|
13
|
-
var _redux = require("redux");
|
|
14
|
-
|
|
15
|
-
var _partial = _interopRequireDefault(require("lodash/partial"));
|
|
16
|
-
|
|
17
|
-
var _reactRedux = require("../../../../../common/react-redux.js");
|
|
18
|
-
|
|
19
|
-
var modalActions = _interopRequireWildcard(require("../../../../../common/actions/modal.js"));
|
|
20
|
-
|
|
21
|
-
var _ui = require("../../../../../common/actions/ui.js");
|
|
22
|
-
|
|
23
|
-
var _quizCommon = require("@instructure/quiz-common");
|
|
24
|
-
|
|
25
|
-
var _index = require("../../../../../common/components/ImportModal/index.js");
|
|
26
|
-
|
|
27
|
-
var _presenter = require("./presenter.js");
|
|
28
|
-
|
|
29
|
-
var _quizzes = require("../../../../../common/selectors/quizzes.js");
|
|
30
|
-
|
|
31
|
-
var _featureCheck = require("../../../../../common/util/featureCheck.js");
|
|
32
|
-
|
|
33
|
-
var _quizExport = require("../../../../../common/actions/quizExport.js");
|
|
34
|
-
|
|
35
|
-
var _alerts = require("../../../../../common/actions/alerts.js");
|
|
36
|
-
|
|
37
|
-
function mapStateToProps(state) {
|
|
38
|
-
var quiz = (0, _quizzes.getActiveQuiz)(state);
|
|
39
|
-
return {
|
|
40
|
-
activeQuizId: quiz.id,
|
|
41
|
-
canExport: !state.getIn(['quizExport', "activeQuiz".concat(quiz.id)]),
|
|
42
|
-
canImport: quiz.canImport(),
|
|
43
|
-
hasQuestions: quiz.hasQuestions(),
|
|
44
|
-
isEditing: state.get('editing') && state.get('editing').some(function (elem) {
|
|
45
|
-
return elem;
|
|
46
|
-
}),
|
|
47
|
-
printingEnabled: (0, _featureCheck.featureOn)('printing')
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
52
|
-
return {
|
|
53
|
-
addAlert: (0, _redux.bindActionCreators)(_alerts.addAlert, dispatch),
|
|
54
|
-
addInfo: (0, _redux.bindActionCreators)(_alerts.addInfo, dispatch),
|
|
55
|
-
openBanksTray: (0, _redux.bindActionCreators)(_ui.set.bind(void 0, _quizCommon.BUILD_TRAY_OPEN, true), dispatch),
|
|
56
|
-
setBanksTrayButtonRef: (0, _redux.bindActionCreators)((0, _partial.default)(_ui.set, _quizCommon.BUILD_TRAY_BUTTON_REF), dispatch),
|
|
57
|
-
startExport: (0, _redux.bindActionCreators)(_quizExport.startQuizExportJob, dispatch),
|
|
58
|
-
openModal: (0, _redux.bindActionCreators)(modalActions.openModal.bind(modalActions, (0, _index.generateImportModalId)('qtiImport')), dispatch)
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
var BuildingButtonsICE = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_presenter.BuildingButtonsICE);
|
|
63
|
-
BuildingButtonsICE.displayName = 'TopNavBarItem';
|
|
64
|
-
var _default = BuildingButtonsICE;
|
|
65
|
-
exports.default = _default;
|
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports.default = exports.BuildingButtonsICE = void 0;
|
|
11
|
-
|
|
12
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
-
|
|
14
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
-
|
|
16
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
-
|
|
18
|
-
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
19
|
-
|
|
20
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
21
|
-
|
|
22
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
23
|
-
|
|
24
|
-
var _uiDrilldown = require("@instructure/ui-drilldown");
|
|
25
|
-
|
|
26
|
-
var _uiView = require("@instructure/ui-view");
|
|
27
|
-
|
|
28
|
-
var _uiTopNavBar = require("@instructure/ui-top-nav-bar");
|
|
29
|
-
|
|
30
|
-
var _uiIcons = require("@instructure/ui-icons");
|
|
31
|
-
|
|
32
|
-
var _index = _interopRequireDefault(require("../../../../../common/components/shared/PrintTrigger/index.js"));
|
|
33
|
-
|
|
34
|
-
var _quizCommon = require("@instructure/quiz-common");
|
|
35
|
-
|
|
36
|
-
var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message"));
|
|
37
|
-
|
|
38
|
-
var _ref = /*#__PURE__*/_react.default.createElement(_uiIcons.IconSpeedGraderLine, null);
|
|
39
|
-
|
|
40
|
-
var _ref2 = /*#__PURE__*/_react.default.createElement(_uiIcons.IconImportLine, {
|
|
41
|
-
"data-automation": "sdk-import-content-icon"
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
var _ref3 = /*#__PURE__*/_react.default.createElement(_uiIcons.IconExportLine, {
|
|
45
|
-
"data-automation": "sdk-export-content-icon"
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
var _ref4 = /*#__PURE__*/_react.default.createElement(_uiIcons.IconBankLine, {
|
|
49
|
-
"data-automation": "sdk-manage-item-banks-icon"
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
var _ref5 = /*#__PURE__*/_react.default.createElement(_uiIcons.IconPrinterLine, {
|
|
53
|
-
"data-automation": "sdk-print-icon"
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
var _ref6 = /*#__PURE__*/_react.default.createElement(_uiIcons.IconPrinterLine, {
|
|
57
|
-
"data-automation": "sdk-print-blank-icon"
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
var BuildingButtonsICE = /*#__PURE__*/function (_Component) {
|
|
61
|
-
(0, _inherits2.default)(BuildingButtonsICE, _Component);
|
|
62
|
-
|
|
63
|
-
var _super = (0, _createSuper2.default)(BuildingButtonsICE);
|
|
64
|
-
|
|
65
|
-
function BuildingButtonsICE() {
|
|
66
|
-
var _this;
|
|
67
|
-
|
|
68
|
-
(0, _classCallCheck2.default)(this, BuildingButtonsICE);
|
|
69
|
-
|
|
70
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
71
|
-
args[_key] = arguments[_key];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
75
|
-
|
|
76
|
-
_this.quizExportAlert = function () {
|
|
77
|
-
_this.props.addInfo((0, _formatMessage.default)("The export process has been started. This can take a while for larger quizzes.\n You can leave the page and you'll get notified when the export is completed."));
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
_this.openBanksTray = function () {
|
|
81
|
-
_this.props.setBanksTrayButtonRef(_this.banksTrayButton);
|
|
82
|
-
|
|
83
|
-
_this.props.openBanksTray();
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
_this.openSpeedgraderLink = function () {
|
|
87
|
-
window.open(_this.props.speedgraderLink, '_blank');
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
_this.startQuizExportJob = function () {
|
|
91
|
-
if (_this.props.canExport) {
|
|
92
|
-
var _this$props = _this.props,
|
|
93
|
-
activeQuizId = _this$props.activeQuizId,
|
|
94
|
-
contextUuid = _this$props.contextUuid;
|
|
95
|
-
var exportSettings = {
|
|
96
|
-
export_type: 'qti',
|
|
97
|
-
everything: false,
|
|
98
|
-
quizzes: [activeQuizId]
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
_this.quizExportAlert();
|
|
102
|
-
|
|
103
|
-
_this.props.contentExport({
|
|
104
|
-
contextUuid: contextUuid,
|
|
105
|
-
exportSettings: exportSettings
|
|
106
|
-
}, _this.props.addAlert);
|
|
107
|
-
|
|
108
|
-
_this.props.startExport(activeQuizId);
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
return _this;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
(0, _createClass2.default)(BuildingButtonsICE, [{
|
|
116
|
-
key: "isBuildingPage",
|
|
117
|
-
value: function isBuildingPage() {
|
|
118
|
-
return 'building' === this.props.app;
|
|
119
|
-
}
|
|
120
|
-
}, {
|
|
121
|
-
key: "renderOptions",
|
|
122
|
-
value: function renderOptions(handlePrint) {
|
|
123
|
-
if (!this.isBuildingPage()) return;
|
|
124
|
-
var options = [];
|
|
125
|
-
|
|
126
|
-
if (this.props.speedgraderLink) {
|
|
127
|
-
options.push( /*#__PURE__*/_react.default.createElement(_uiDrilldown.Drilldown.Option, {
|
|
128
|
-
id: "speedgrader",
|
|
129
|
-
key: "speedgrader",
|
|
130
|
-
onOptionClick: this.openSpeedgraderLink
|
|
131
|
-
}, _ref, /*#__PURE__*/_react.default.createElement(_uiView.View, {
|
|
132
|
-
as: "span",
|
|
133
|
-
margin: "0 0 0 x-small"
|
|
134
|
-
}, (0, _formatMessage.default)('Speedgrader'))));
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
options.push( /*#__PURE__*/_react.default.createElement(_uiDrilldown.Drilldown.Option, {
|
|
138
|
-
id: "import",
|
|
139
|
-
key: "import",
|
|
140
|
-
disabled: !this.props.canImport,
|
|
141
|
-
onOptionClick: this.props.openModal,
|
|
142
|
-
"data-automation": "sdk-import-content-menuitem"
|
|
143
|
-
}, _ref2, /*#__PURE__*/_react.default.createElement(_uiView.View, {
|
|
144
|
-
as: "span",
|
|
145
|
-
margin: "0 0 0 x-small"
|
|
146
|
-
}, (0, _formatMessage.default)('Import Content'))));
|
|
147
|
-
|
|
148
|
-
if (this.props.contentExportEnabled) {
|
|
149
|
-
options.push( /*#__PURE__*/_react.default.createElement(_uiDrilldown.Drilldown.Option, {
|
|
150
|
-
id: "export",
|
|
151
|
-
key: "export",
|
|
152
|
-
disabled: !this.props.canExport,
|
|
153
|
-
onOptionClick: this.startQuizExportJob,
|
|
154
|
-
"data-automation": "sdk-export-content-menuitem"
|
|
155
|
-
}, _ref3, /*#__PURE__*/_react.default.createElement(_uiView.View, {
|
|
156
|
-
as: "span",
|
|
157
|
-
margin: "0 0 0 x-small"
|
|
158
|
-
}, (0, _formatMessage.default)('Export Content'))));
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (this.props.enableItemBanking) {
|
|
162
|
-
options.push( /*#__PURE__*/_react.default.createElement(_uiDrilldown.Drilldown.Option, {
|
|
163
|
-
id: "banks",
|
|
164
|
-
key: "banks",
|
|
165
|
-
onOptionClick: this.props.navigateToBanks,
|
|
166
|
-
"data-automation": "sdk-manage-item-banks-menuitem"
|
|
167
|
-
}, _ref4, /*#__PURE__*/_react.default.createElement(_uiView.View, {
|
|
168
|
-
as: "span",
|
|
169
|
-
margin: "0 0 0 x-small"
|
|
170
|
-
}, (0, _formatMessage.default)('Manage Item Banks'))));
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
if (this.props.printingEnabled) {
|
|
174
|
-
{
|
|
175
|
-
/* eslint-disable react/jsx-no-bind */
|
|
176
|
-
}
|
|
177
|
-
options.push( /*#__PURE__*/_react.default.createElement(_uiDrilldown.Drilldown.Option, {
|
|
178
|
-
id: "printKey",
|
|
179
|
-
key: "printKey",
|
|
180
|
-
disabled: !this.props.hasQuestions || this.props.isEditing,
|
|
181
|
-
onOptionClick: function onOptionClick() {
|
|
182
|
-
return handlePrint(_quizCommon.PRINT_CURRENT_PAGE);
|
|
183
|
-
},
|
|
184
|
-
"data-automation": "sdk-print-key-menuitem"
|
|
185
|
-
}, _ref5, /*#__PURE__*/_react.default.createElement(_uiView.View, {
|
|
186
|
-
as: "span",
|
|
187
|
-
margin: "0 0 0 x-small"
|
|
188
|
-
}, (0, _formatMessage.default)('Print Key (With Answers)'))));
|
|
189
|
-
options.push( /*#__PURE__*/_react.default.createElement(_uiDrilldown.Drilldown.Option, {
|
|
190
|
-
id: "printBlank",
|
|
191
|
-
key: "printBlank",
|
|
192
|
-
disabled: !this.props.hasQuestions || this.props.isEditing,
|
|
193
|
-
onOptionClick: function onOptionClick() {
|
|
194
|
-
return handlePrint(_quizCommon.PRINT_BLANK);
|
|
195
|
-
},
|
|
196
|
-
"data-automation": "sdk-print-blank-menuitem"
|
|
197
|
-
}, _ref6, /*#__PURE__*/_react.default.createElement(_uiView.View, {
|
|
198
|
-
as: "span",
|
|
199
|
-
margin: "0 0 0 x-small"
|
|
200
|
-
}, (0, _formatMessage.default)('Print Blank Quiz'))));
|
|
201
|
-
{
|
|
202
|
-
/* eslint-enable react/jsx-no-bind */
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
if (options.length < 1) return;
|
|
207
|
-
return /*#__PURE__*/_react.default.createElement(_uiTopNavBar.TopNavBar.Item, {
|
|
208
|
-
id: this.props.id,
|
|
209
|
-
variant: "icon",
|
|
210
|
-
renderIcon: this.props.renderIcon,
|
|
211
|
-
showSubmenuChevron: false,
|
|
212
|
-
renderSubmenu: /*#__PURE__*/_react.default.createElement(_uiDrilldown.Drilldown, {
|
|
213
|
-
rootPageId: "root"
|
|
214
|
-
}, /*#__PURE__*/_react.default.createElement(_uiDrilldown.Drilldown.Page, {
|
|
215
|
-
id: "root"
|
|
216
|
-
}, options))
|
|
217
|
-
}, (0, _formatMessage.default)('More'));
|
|
218
|
-
}
|
|
219
|
-
}, {
|
|
220
|
-
key: "render",
|
|
221
|
-
value: function render() {
|
|
222
|
-
var _this2 = this;
|
|
223
|
-
|
|
224
|
-
/* eslint-disable react/jsx-no-bind */
|
|
225
|
-
return /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
226
|
-
render: function render(handlePrint) {
|
|
227
|
-
return _this2.renderOptions(handlePrint);
|
|
228
|
-
},
|
|
229
|
-
navigateToPreviewPrint: this.props.navigateToPreviewPrint
|
|
230
|
-
});
|
|
231
|
-
/* eslint-enable react/jsx-no-bind */
|
|
232
|
-
}
|
|
233
|
-
}]);
|
|
234
|
-
BuildingButtonsICE.displayName = "BuildingButtonsICE";
|
|
235
|
-
return BuildingButtonsICE;
|
|
236
|
-
}(_react.Component);
|
|
237
|
-
|
|
238
|
-
exports.BuildingButtonsICE = BuildingButtonsICE;
|
|
239
|
-
BuildingButtonsICE.propTypes = {
|
|
240
|
-
id: _propTypes.default.string.isRequired,
|
|
241
|
-
renderIcon: _propTypes.default.element.isRequired,
|
|
242
|
-
app: _propTypes.default.string,
|
|
243
|
-
addAlert: _propTypes.default.func.isRequired,
|
|
244
|
-
addInfo: _propTypes.default.func,
|
|
245
|
-
activeQuizId: _propTypes.default.string,
|
|
246
|
-
canExport: _propTypes.default.bool.isRequired,
|
|
247
|
-
canImport: _propTypes.default.bool.isRequired,
|
|
248
|
-
contentExportEnabled: _propTypes.default.bool,
|
|
249
|
-
contentExport: _propTypes.default.func,
|
|
250
|
-
enableItemBanking: _propTypes.default.bool,
|
|
251
|
-
hasQuestions: _propTypes.default.bool.isRequired,
|
|
252
|
-
isEditing: _propTypes.default.bool.isRequired,
|
|
253
|
-
navigateToBanks: _propTypes.default.func.isRequired,
|
|
254
|
-
navigateToPreviewPrint: _propTypes.default.func.isRequired,
|
|
255
|
-
openBanksTray: _propTypes.default.func.isRequired,
|
|
256
|
-
openModal: _propTypes.default.func.isRequired,
|
|
257
|
-
printingEnabled: _propTypes.default.bool.isRequired,
|
|
258
|
-
setBanksTrayButtonRef: _propTypes.default.func.isRequired,
|
|
259
|
-
speedgraderLink: _propTypes.default.string,
|
|
260
|
-
startExport: _propTypes.default.func.isRequired,
|
|
261
|
-
contextUuid: _propTypes.default.string
|
|
262
|
-
};
|
|
263
|
-
BuildingButtonsICE.defaultProps = {
|
|
264
|
-
activeQuizId: null,
|
|
265
|
-
addInfo: function addInfo() {},
|
|
266
|
-
app: null,
|
|
267
|
-
contentExportEnabled: false,
|
|
268
|
-
contentExport: null,
|
|
269
|
-
enableItemBanking: true,
|
|
270
|
-
speedgraderLink: null,
|
|
271
|
-
contextUuid: null
|
|
272
|
-
};
|
|
273
|
-
var _default = BuildingButtonsICE;
|
|
274
|
-
exports.default = _default;
|