@instructure/quiz-core 20.6.0 → 20.6.1-rc.1
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/es/banks/api/banks.js +8 -1
- package/es/banks/components/SharingModal/RootAccountSharing.js +94 -0
- package/es/banks/components/SharingModal/ShareList/index.js +24 -2
- package/es/banks/components/SharingModal/presenter.js +13 -0
- package/es/building/components/resources/ItemFeedbackModal/index.js +1 -2
- package/es/building/components/resources/ItemFeedbackModal/presenter.js +2 -15
- package/es/building/components/resources/quiz/instructions/Edit/presenter.js +3 -6
- package/es/building/components/resources/quiz/instructions/Instructions/presenter.js +1 -2
- package/es/common/components/resources/item/ItemEdit/presenter.js +1 -14
- package/es/common/util/interactionTypePropsHelper.js +1 -1
- package/es/index.js +0 -2
- package/lib/banks/api/banks.js +8 -1
- package/lib/banks/components/SharingModal/RootAccountSharing.js +121 -0
- package/lib/banks/components/SharingModal/ShareList/index.js +25 -2
- package/lib/banks/components/SharingModal/presenter.js +13 -0
- package/lib/building/components/resources/ItemFeedbackModal/index.js +0 -1
- package/lib/building/components/resources/ItemFeedbackModal/presenter.js +1 -15
- package/lib/building/components/resources/quiz/instructions/Edit/presenter.js +4 -7
- package/lib/building/components/resources/quiz/instructions/Instructions/presenter.js +1 -2
- package/lib/common/components/resources/item/ItemEdit/presenter.js +1 -15
- package/lib/common/util/interactionTypePropsHelper.js +2 -2
- package/lib/index.js +80 -98
- package/package.json +10 -10
- package/es/common/components/RichContentInput/RceImageImportModal/index.js +0 -15
- package/es/common/components/RichContentInput/RceImageImportModal/presenter.js +0 -93
- package/es/common/components/RichContentInput/index.js +0 -21
- package/es/common/components/RichContentInput/presenter.js +0 -82
- package/lib/common/components/RichContentInput/RceImageImportModal/index.js +0 -28
- package/lib/common/components/RichContentInput/RceImageImportModal/presenter.js +0 -115
- package/lib/common/components/RichContentInput/index.js +0 -33
- package/lib/common/components/RichContentInput/presenter.js +0 -102
package/es/banks/api/banks.js
CHANGED
|
@@ -140,6 +140,7 @@ export function getExistingBankAndEntries(bankId) {
|
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
142
|
export var updateBank = function updateBank(bank) {
|
|
143
|
+
var clearPagination = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
143
144
|
var url = "".concat(banksApiEndpoint, "/").concat(bank.id);
|
|
144
145
|
return function (dispatch, getState) {
|
|
145
146
|
var updatedBankData = JSON.stringify({
|
|
@@ -155,7 +156,13 @@ export var updateBank = function updateBank(bank) {
|
|
|
155
156
|
return fetcher.patch(url, {
|
|
156
157
|
body: updatedBankData
|
|
157
158
|
}).then(function (bankData) {
|
|
158
|
-
|
|
159
|
+
var toDispatch = [handleBankResponse(bankData)];
|
|
160
|
+
|
|
161
|
+
if (clearPagination) {
|
|
162
|
+
toDispatch.push(clear(BANKS_BANK_PAGINATION));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
dispatch(toDispatch);
|
|
159
166
|
return bankData;
|
|
160
167
|
});
|
|
161
168
|
};
|
|
@@ -0,0 +1,94 @@
|
|
|
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
|
+
|
|
6
|
+
var _dec, _class, _class2, _temp;
|
|
7
|
+
|
|
8
|
+
import React, { Component } from 'react';
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
import { CAN_EDIT, READ_ONLY } from '@instructure/quiz-common';
|
|
11
|
+
import { IconAdminLine } from '@instructure/ui-icons';
|
|
12
|
+
import { Checkbox } from '@instructure/ui-checkbox';
|
|
13
|
+
import { View } from '@instructure/ui-view';
|
|
14
|
+
import { Grid } from '@instructure/ui-grid';
|
|
15
|
+
import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
16
|
+
import { SimpleSelect } from '@instructure/ui-simple-select';
|
|
17
|
+
import { withStyle } from '@instructure/emotion';
|
|
18
|
+
import generateStyle from "./styles.js";
|
|
19
|
+
import generateComponentTheme from "./theme.js";
|
|
20
|
+
import t from '@instructure/quiz-i18n/es/format-message';
|
|
21
|
+
|
|
22
|
+
var _ref = /*#__PURE__*/React.createElement(Grid.Col, {
|
|
23
|
+
width: "auto"
|
|
24
|
+
}, /*#__PURE__*/React.createElement(IconAdminLine, {
|
|
25
|
+
size: "medium"
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
export var RootAccountSharing = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
29
|
+
_inherits(RootAccountSharing, _Component);
|
|
30
|
+
|
|
31
|
+
var _super = _createSuper(RootAccountSharing);
|
|
32
|
+
|
|
33
|
+
function RootAccountSharing() {
|
|
34
|
+
var _this;
|
|
35
|
+
|
|
36
|
+
_classCallCheck(this, RootAccountSharing);
|
|
37
|
+
|
|
38
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
39
|
+
args[_key] = arguments[_key];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
43
|
+
|
|
44
|
+
_this.isSharedWithAccount = function () {
|
|
45
|
+
return [READ_ONLY, CAN_EDIT].includes(_this.props.accountPermission);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return _this;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
_createClass(RootAccountSharing, [{
|
|
52
|
+
key: "render",
|
|
53
|
+
value: function render() {
|
|
54
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
55
|
+
as: "div",
|
|
56
|
+
margin: "0 0 medium 0"
|
|
57
|
+
}, /*#__PURE__*/React.createElement(Grid, {
|
|
58
|
+
colSpacing: "small"
|
|
59
|
+
}, /*#__PURE__*/React.createElement(Grid.Row, null, _ref, /*#__PURE__*/React.createElement(Grid.Col, null, /*#__PURE__*/React.createElement(View, {
|
|
60
|
+
as: "div",
|
|
61
|
+
padding: "0 0 x-small 0"
|
|
62
|
+
}, this.props.accountName || t('Account')), /*#__PURE__*/React.createElement(Checkbox, {
|
|
63
|
+
label: t('Share with Institution'),
|
|
64
|
+
variant: "toggle",
|
|
65
|
+
value: "accountPermission",
|
|
66
|
+
checked: this.isSharedWithAccount(),
|
|
67
|
+
onChange: this.props.onShareChange
|
|
68
|
+
})), this.isSharedWithAccount() && /*#__PURE__*/React.createElement(Grid.Col, {
|
|
69
|
+
width: "auto"
|
|
70
|
+
}, /*#__PURE__*/React.createElement(SimpleSelect, {
|
|
71
|
+
onChange: this.props.onShareTypeChange,
|
|
72
|
+
value: this.props.accountPermission,
|
|
73
|
+
renderLabel: /*#__PURE__*/React.createElement(ScreenReaderContent, null, t('Access for account'))
|
|
74
|
+
}, /*#__PURE__*/React.createElement(SimpleSelect.Option, {
|
|
75
|
+
id: "sharing-modal-account-perm-select-option-can-view",
|
|
76
|
+
value: READ_ONLY
|
|
77
|
+
}, t('Can view')), /*#__PURE__*/React.createElement(SimpleSelect.Option, {
|
|
78
|
+
id: "sharing-modal-account-perm-select-option-can-edit",
|
|
79
|
+
value: CAN_EDIT
|
|
80
|
+
}, t('Can edit')))))));
|
|
81
|
+
}
|
|
82
|
+
}]);
|
|
83
|
+
|
|
84
|
+
RootAccountSharing.displayName = "RootAccountSharing";
|
|
85
|
+
return RootAccountSharing;
|
|
86
|
+
}(Component), _class2.propTypes = {
|
|
87
|
+
accountName: PropTypes.string.isRequired,
|
|
88
|
+
onShareChange: PropTypes.func.isRequired,
|
|
89
|
+
onShareTypeChange: PropTypes.func.isRequired,
|
|
90
|
+
accountPermission: PropTypes.string
|
|
91
|
+
}, _class2.defaultProps = {
|
|
92
|
+
accountPermission: null
|
|
93
|
+
}, _temp)) || _class);
|
|
94
|
+
export default RootAccountSharing;
|
|
@@ -19,6 +19,7 @@ import { Avatar } from '@instructure/ui-avatar';
|
|
|
19
19
|
import { Tabs } from '@instructure/ui-tabs';
|
|
20
20
|
import { withStyle, jsx } from '@instructure/emotion';
|
|
21
21
|
import { ContextualIconButton } from "../ContextualIconButton/index.js";
|
|
22
|
+
import RootAccountSharing from "../RootAccountSharing.js";
|
|
22
23
|
import { SimpleSelect } from '@instructure/ui-simple-select';
|
|
23
24
|
import generateStyle from "./styles.js";
|
|
24
25
|
import { CAN_EDIT, READ_ONLY, REMOVED_ACCESS, SHARED_WITH_USER, SHARED_WITH_COURSE } from '@instructure/quiz-common';
|
|
@@ -147,6 +148,8 @@ export var ShareList = (_dec = withStyle(generateStyle, null), _dec(_class = (_t
|
|
|
147
148
|
}, {
|
|
148
149
|
key: "render",
|
|
149
150
|
value: function render() {
|
|
151
|
+
var _this$props$currentUs;
|
|
152
|
+
|
|
150
153
|
var _this$props = this.props,
|
|
151
154
|
shares = _this$props.shares,
|
|
152
155
|
subAccountBankSharingEnabled = _this$props.subAccountBankSharingEnabled;
|
|
@@ -196,7 +199,16 @@ export var ShareList = (_dec = withStyle(generateStyle, null), _dec(_class = (_t
|
|
|
196
199
|
lineHeight: "double"
|
|
197
200
|
}, t('Currently shared with')), jsx(Grid, {
|
|
198
201
|
vAlign: "middle"
|
|
199
|
-
}, existingCourses.map(this.renderEntity)))
|
|
202
|
+
}, existingCourses.map(this.renderEntity))), subAccountBankSharingEnabled && jsx(Tabs.Panel, {
|
|
203
|
+
renderTitle: t('Accounts'),
|
|
204
|
+
isSelected: this.state.selectedTabIndex === 2,
|
|
205
|
+
padding: "large small small small"
|
|
206
|
+
}, ((_this$props$currentUs = this.props.currentUser) === null || _this$props$currentUs === void 0 ? void 0 : _this$props$currentUs.bank_admin) && jsx(RootAccountSharing, {
|
|
207
|
+
accountName: this.props.accountName,
|
|
208
|
+
onShareChange: this.props.onToggleAccountShare,
|
|
209
|
+
onShareTypeChange: this.props.onAccountPermissionChange,
|
|
210
|
+
accountPermission: this.props.accountPermission
|
|
211
|
+
})))));
|
|
200
212
|
}
|
|
201
213
|
}]);
|
|
202
214
|
|
|
@@ -204,6 +216,9 @@ export var ShareList = (_dec = withStyle(generateStyle, null), _dec(_class = (_t
|
|
|
204
216
|
return ShareList;
|
|
205
217
|
}(Component), _class2.propTypes = {
|
|
206
218
|
canEdit: PropTypes.bool.isRequired,
|
|
219
|
+
currentUser: PropTypes.shape({
|
|
220
|
+
bank_admin: PropTypes.bool
|
|
221
|
+
}),
|
|
207
222
|
improvedBankSharingEnabled: PropTypes.bool.isRequired,
|
|
208
223
|
newEntities: ImmutablePropTypes.list,
|
|
209
224
|
onEntityRemove: PropTypes.func.isRequired,
|
|
@@ -220,8 +235,15 @@ export var ShareList = (_dec = withStyle(generateStyle, null), _dec(_class = (_t
|
|
|
220
235
|
})).isRequired,
|
|
221
236
|
subAccountBankSharingEnabled: PropTypes.bool.isRequired,
|
|
222
237
|
// eslint-disable-next-line react/require-default-props,react/forbid-prop-types
|
|
223
|
-
styles: PropTypes.object
|
|
238
|
+
styles: PropTypes.object,
|
|
239
|
+
accountName: PropTypes.string,
|
|
240
|
+
onAccountPermissionChange: PropTypes.func.isRequired,
|
|
241
|
+
onToggleAccountShare: PropTypes.func.isRequired,
|
|
242
|
+
accountPermission: PropTypes.string
|
|
224
243
|
}, _class2.defaultProps = {
|
|
244
|
+
accountName: t('Account'),
|
|
245
|
+
accountPermission: null,
|
|
246
|
+
currentUser: null,
|
|
225
247
|
newEntities: List(),
|
|
226
248
|
sharedBanks: List()
|
|
227
249
|
}, _temp)) || _class);
|
|
@@ -426,6 +426,14 @@ export var SharingModalPresenter = (_dec = withStyle(generateStyle, generateComp
|
|
|
426
426
|
accountPermission: nextProps.bank.accountPermission,
|
|
427
427
|
shares: nextProps.sharedBanks
|
|
428
428
|
});
|
|
429
|
+
}
|
|
430
|
+
}, {
|
|
431
|
+
key: "componentDidUpdate",
|
|
432
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
433
|
+
if (this.props.subAccountBankSharingEnabled && this.state.accountPermission !== prevState.accountPermission && this.state.accountPermission !== this.props.bank.accountPermission) {
|
|
434
|
+
var updatedBank = this.props.bank.set('accountPermission', this.state.accountPermission);
|
|
435
|
+
this.props.updateBank(updatedBank, false);
|
|
436
|
+
}
|
|
429
437
|
} // =============
|
|
430
438
|
// HELPERS
|
|
431
439
|
// =============
|
|
@@ -485,12 +493,17 @@ export var SharingModalPresenter = (_dec = withStyle(generateStyle, generateComp
|
|
|
485
493
|
key: "renderEntitiesSection",
|
|
486
494
|
value: function renderEntitiesSection() {
|
|
487
495
|
return jsx(ShareList, {
|
|
496
|
+
accountName: this.props.currentUser.account_name,
|
|
497
|
+
accountPermission: this.state.accountPermission,
|
|
488
498
|
canEdit: this.props.bank.canEdit(),
|
|
499
|
+
currentUser: this.props.currentUser,
|
|
489
500
|
entitiesWithChangedPermission: this.state.entitiesWithChangedPermission,
|
|
490
501
|
improvedBankSharingEnabled: this.props.improvedBankSharingEnabled,
|
|
491
502
|
newEntities: this.state.newEntities,
|
|
503
|
+
onAccountPermissionChange: this.handleAccountPermissionChange,
|
|
492
504
|
onEntityRemove: this.handleEntityRemove,
|
|
493
505
|
onPermissionChange: this.handleEntityPermissionChange,
|
|
506
|
+
onToggleAccountShare: this.toggleAccountShare,
|
|
494
507
|
ref: this.handleShareListRef,
|
|
495
508
|
renderSearchSection: this.renderSearchSection // searchPermission and searchSelection are not used directly by ShareList,
|
|
496
509
|
// but are needed as props so that AsyncSearch/Select rerenders when those values change
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Map } from 'immutable';
|
|
2
2
|
import { connect } from "../../../../common/react-redux.js";
|
|
3
3
|
import { ItemFeedbackModal as ItemFeedbackModalPresenter } from "./presenter.js";
|
|
4
|
-
import { closeModal
|
|
4
|
+
import { closeModal } from "../../../../common/actions/modal.js";
|
|
5
5
|
import { changeItemFeedback } from "../../../../common/actions/modifications.js";
|
|
6
6
|
import Item from "../../../../common/records/Item.js";
|
|
7
7
|
import { set } from "../../../../common/actions/ui.js";
|
|
@@ -25,7 +25,6 @@ function mapStateToProps(state, props) {
|
|
|
25
25
|
var mapDispatchToProps = {
|
|
26
26
|
closeModal: closeModal,
|
|
27
27
|
changeItemFeedback: changeItemFeedback,
|
|
28
|
-
openModal: openModal,
|
|
29
28
|
setUi: set
|
|
30
29
|
};
|
|
31
30
|
export var ItemFeedbackModal = connect(mapStateToProps, mapDispatchToProps)(ItemFeedbackModalPresenter);
|
|
@@ -11,10 +11,9 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
|
11
11
|
import { Button, CloseButton } from '@instructure/ui-buttons';
|
|
12
12
|
import { Heading } from '@instructure/ui-heading';
|
|
13
13
|
import { themeable } from '@instructure/ui-themeable';
|
|
14
|
-
import { RichContentRenderer, RCE_THREE_LINES_HEIGHT } from '@instructure/quiz-rce';
|
|
15
|
-
import { RichContentInput } from "../../../../common/components/RichContentInput/index.js";
|
|
14
|
+
import { RichContentRenderer, RichContentInput, RCE_THREE_LINES_HEIGHT } from '@instructure/quiz-rce';
|
|
16
15
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
17
|
-
import { Modal, ModalHeader, ModalBody, ModalFooter,
|
|
16
|
+
import { Modal, ModalHeader, ModalBody, ModalFooter, ITEM_FEEDBACK_MODAL_FEEDBACK, XSMALL_SIDE_MARGIN } from '@instructure/quiz-common';
|
|
18
17
|
var styles = {
|
|
19
18
|
componentId: 'esPWW',
|
|
20
19
|
template: function template(theme) {
|
|
@@ -67,12 +66,6 @@ export var ItemFeedbackModal = (_dec = themeable(theme, styles), _dec(_class = (
|
|
|
67
66
|
_this.props.closeModal();
|
|
68
67
|
};
|
|
69
68
|
|
|
70
|
-
_this.returnToFeedback = function () {
|
|
71
|
-
_this.props.openModal(ITEM_FEEDBACK_MODAL, {
|
|
72
|
-
modalTrigger: _this.props.modalTrigger
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
|
|
76
69
|
return _this;
|
|
77
70
|
}
|
|
78
71
|
|
|
@@ -104,9 +97,6 @@ export var ItemFeedbackModal = (_dec = themeable(theme, styles), _dec(_class = (
|
|
|
104
97
|
textareaId: key,
|
|
105
98
|
defaultContent: this.props.feedback.get(key),
|
|
106
99
|
onChange: this.onFeedbackWrapper(key),
|
|
107
|
-
parentType: this.props.parentType,
|
|
108
|
-
parentId: this.props.parentId,
|
|
109
|
-
importModalCloseOverride: this.returnToFeedback,
|
|
110
100
|
height: RCE_THREE_LINES_HEIGHT
|
|
111
101
|
}));
|
|
112
102
|
}
|
|
@@ -150,9 +140,6 @@ export var ItemFeedbackModal = (_dec = themeable(theme, styles), _dec(_class = (
|
|
|
150
140
|
importModalOpen: PropTypes.bool.isRequired,
|
|
151
141
|
item: ImmutablePropTypes.record.isRequired,
|
|
152
142
|
modalOpen: PropTypes.bool.isRequired,
|
|
153
|
-
openModal: PropTypes.func.isRequired,
|
|
154
|
-
parentId: PropTypes.string.isRequired,
|
|
155
|
-
parentType: PropTypes.string.isRequired,
|
|
156
143
|
setUi: PropTypes.func.isRequired,
|
|
157
144
|
modalTrigger: PropTypes.instanceOf(Component)
|
|
158
145
|
}, _class2.defaultProps = {
|
|
@@ -10,11 +10,11 @@ import PropTypes from 'prop-types';
|
|
|
10
10
|
import { Button } from '@instructure/ui-buttons';
|
|
11
11
|
import { themeable } from '@instructure/ui-themeable';
|
|
12
12
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
13
|
-
import RichContentInput from "../../../../../../common/components/RichContentInput/index.js";
|
|
14
13
|
import wrapWithOutsideClick from "../../../../../../common/components/shared/functionality/componentWithOutsideClick.js";
|
|
15
14
|
import CustomPropTypes from "../../../../../../common/util/CustomPropTypes.js";
|
|
16
15
|
import elementsForSelectors from "../../../../../../common/util/ElementsForSelectors.js";
|
|
17
|
-
import {
|
|
16
|
+
import { INSTRUCTIONS_EDIT_ID } from '@instructure/quiz-common';
|
|
17
|
+
import { RichContentInput } from '@instructure/quiz-rce';
|
|
18
18
|
var styles = {
|
|
19
19
|
componentId: 'evnrd',
|
|
20
20
|
template: function template(theme) {
|
|
@@ -67,9 +67,7 @@ var QuizInstructionsEdit = (_dec = themeable(theme, styles), _dec(_class = (_tem
|
|
|
67
67
|
textareaClassName: styles.instructionsEditInput,
|
|
68
68
|
defaultContent: this.props.inputValue,
|
|
69
69
|
onKeyUp: this.props.onInputChange,
|
|
70
|
-
onChange: this.props.onInputChange
|
|
71
|
-
parentType: PARENT_TYPE_QUIZ,
|
|
72
|
-
parentId: this.props.quizId
|
|
70
|
+
onChange: this.props.onInputChange
|
|
73
71
|
}), /*#__PURE__*/React.createElement("div", {
|
|
74
72
|
className: styles.footer
|
|
75
73
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
@@ -89,7 +87,6 @@ var QuizInstructionsEdit = (_dec = themeable(theme, styles), _dec(_class = (_tem
|
|
|
89
87
|
endEditing: PropTypes.func.isRequired,
|
|
90
88
|
inputValue: PropTypes.string.isRequired,
|
|
91
89
|
onInputChange: PropTypes.func.isRequired,
|
|
92
|
-
quizId: PropTypes.string.isRequired,
|
|
93
90
|
saveAndPreview: PropTypes.func.isRequired,
|
|
94
91
|
appContainer: CustomPropTypes.selectors.isRequired
|
|
95
92
|
}, _temp)) || _class);
|
|
@@ -149,8 +149,7 @@ export var QuizInstructions = (_dec = themeable(theme, styles), _dec(_class = (_
|
|
|
149
149
|
inputValue: this.workingInstructions(),
|
|
150
150
|
onInputChange: this.updateWorkingInstructions,
|
|
151
151
|
ref: this.setRef('instructionsEdit'),
|
|
152
|
-
saveAndPreview: this.saveAndPreview
|
|
153
|
-
quizId: this.props.quiz.id
|
|
152
|
+
saveAndPreview: this.saveAndPreview
|
|
154
153
|
});
|
|
155
154
|
}
|
|
156
155
|
}, {
|
|
@@ -14,7 +14,6 @@ import componentForItem from "../../../../util/componentForItem.js";
|
|
|
14
14
|
import { liveRegion, COMPONENT_EDIT } from '@instructure/quiz-common';
|
|
15
15
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
16
16
|
import { propsForInteractionEdit } from "../../../../util/interactionTypePropsHelper.js";
|
|
17
|
-
import RceImageImportModal from "../../../../components/RichContentInput/RceImageImportModal/index.js";
|
|
18
17
|
import elementsForSelectors from "../../../../../common/util/ElementsForSelectors.js";
|
|
19
18
|
import { toErrors } from "../../../../util/instUIMessages.js";
|
|
20
19
|
export var ItemEdit = /*#__PURE__*/function (_Component) {
|
|
@@ -63,16 +62,6 @@ export var ItemEdit = /*#__PURE__*/function (_Component) {
|
|
|
63
62
|
}
|
|
64
63
|
};
|
|
65
64
|
|
|
66
|
-
_this.renderImportModal = function (importModalId, onSuccess, onClose) {
|
|
67
|
-
return /*#__PURE__*/React.createElement(RceImageImportModal, {
|
|
68
|
-
importModalId: importModalId,
|
|
69
|
-
onClose: onClose,
|
|
70
|
-
onSuccess: onSuccess,
|
|
71
|
-
parentId: _this.props.parentId,
|
|
72
|
-
parentType: _this.props.parentType
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
|
|
76
65
|
return _this;
|
|
77
66
|
}
|
|
78
67
|
|
|
@@ -136,8 +125,7 @@ export var ItemEdit = /*#__PURE__*/function (_Component) {
|
|
|
136
125
|
name: "edit_item_".concat(this.props.guid) // eslint-disable-line react/jsx-no-literals
|
|
137
126
|
|
|
138
127
|
}, /*#__PURE__*/React.createElement(Interaction, Object.assign({}, propsForInteraction, {
|
|
139
|
-
itemId: this.props.guid
|
|
140
|
-
renderImportModal: this.renderImportModal
|
|
128
|
+
itemId: this.props.guid
|
|
141
129
|
})));
|
|
142
130
|
}
|
|
143
131
|
}]);
|
|
@@ -169,7 +157,6 @@ ItemEdit.propTypes = {
|
|
|
169
157
|
handleQuizEntryPointsChange: PropTypes.func.isRequired,
|
|
170
158
|
interactionFileUpload: PropTypes.func.isRequired,
|
|
171
159
|
oneQuestionAtATime: PropTypes.bool.isRequired,
|
|
172
|
-
openImportModal: PropTypes.func.isRequired,
|
|
173
160
|
parentId: PropTypes.string.isRequired,
|
|
174
161
|
parentType: PropTypes.string.isRequired,
|
|
175
162
|
partialDeepScoringEnabled: PropTypes.bool,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import RichContentInput from
|
|
1
|
+
import { RichContentInput } from '@instructure/quiz-rce';
|
|
2
2
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
3
3
|
export var propsForInteractionEdit = function propsForInteractionEdit(props, additionalOptions) {
|
|
4
4
|
var item = props.workingItem.toJS();
|
package/es/index.js
CHANGED
|
@@ -23,7 +23,6 @@ export { QuizzesSpinner } from "./common/components/shared/spinner/Spinner.js";
|
|
|
23
23
|
export { PrintTrigger } from "./common/components/shared/PrintTrigger/index.js";
|
|
24
24
|
export { IfFeature } from "./common/components/shared/IfFeature/index.js";
|
|
25
25
|
export { UndecoratedQuizEntryEdit } from "./building/components/resources/quizEntry/QuizEntryEdit/presenter.js";
|
|
26
|
-
export { RichContentInput } from "./common/components/RichContentInput/index.js";
|
|
27
26
|
export { ResultStimulus } from "./common/components/resources/sessionItemResult/ResultStimulus/index.js";
|
|
28
27
|
export { Stimulus as StimulusView } from "./common/components/layout/sidebar/Stimulus/index.js";
|
|
29
28
|
export { Sidebar } from "./common/components/layout/sidebar/Sidebar/index.js";
|
|
@@ -42,7 +41,6 @@ export { CentileDistribution } from "./reporting/components/charts/Distribution/
|
|
|
42
41
|
export { OutcomeAnalysis } from "./reporting/components/resources/OutcomeAnalysis/index.js";
|
|
43
42
|
export { PositionBox } from "./common/components/resources/positionBox/PositionBox.js";
|
|
44
43
|
export { Pin } from "./common/components/Pin/index.js";
|
|
45
|
-
export { RceImageImportModal } from "./common/components/RichContentInput/RceImageImportModal/index.js";
|
|
46
44
|
export { SessionItemResult as SessionItemResultView } from "./common/components/resources/sessionItemResult/SessionItemResult/index.js";
|
|
47
45
|
export { Card } from "./common/components/shared/Card/index.js";
|
|
48
46
|
export { CardContent } from "./common/components/shared/Card/CardContent/index.js";
|
package/lib/banks/api/banks.js
CHANGED
|
@@ -182,6 +182,7 @@ function getExistingBankAndEntries(bankId) {
|
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
var updateBank = function updateBank(bank) {
|
|
185
|
+
var clearPagination = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
185
186
|
var url = "".concat(banksApiEndpoint, "/").concat(bank.id);
|
|
186
187
|
return function (dispatch, getState) {
|
|
187
188
|
var updatedBankData = JSON.stringify({
|
|
@@ -197,7 +198,13 @@ var updateBank = function updateBank(bank) {
|
|
|
197
198
|
return fetcher.patch(url, {
|
|
198
199
|
body: updatedBankData
|
|
199
200
|
}).then(function (bankData) {
|
|
200
|
-
|
|
201
|
+
var toDispatch = [(0, _callHandlers.handleBankResponse)(bankData)];
|
|
202
|
+
|
|
203
|
+
if (clearPagination) {
|
|
204
|
+
toDispatch.push((0, _ui.clear)(_quizCommon.BANKS_BANK_PAGINATION));
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
dispatch(toDispatch);
|
|
201
208
|
return bankData;
|
|
202
209
|
});
|
|
203
210
|
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = exports.RootAccountSharing = 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 _quizCommon = require("@instructure/quiz-common");
|
|
25
|
+
|
|
26
|
+
var _uiIcons = require("@instructure/ui-icons");
|
|
27
|
+
|
|
28
|
+
var _uiCheckbox = require("@instructure/ui-checkbox");
|
|
29
|
+
|
|
30
|
+
var _uiView = require("@instructure/ui-view");
|
|
31
|
+
|
|
32
|
+
var _uiGrid = require("@instructure/ui-grid");
|
|
33
|
+
|
|
34
|
+
var _uiA11yContent = require("@instructure/ui-a11y-content");
|
|
35
|
+
|
|
36
|
+
var _uiSimpleSelect = require("@instructure/ui-simple-select");
|
|
37
|
+
|
|
38
|
+
var _emotion = require("@instructure/emotion");
|
|
39
|
+
|
|
40
|
+
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
41
|
+
|
|
42
|
+
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
43
|
+
|
|
44
|
+
var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message"));
|
|
45
|
+
|
|
46
|
+
var _dec, _class, _class2, _temp;
|
|
47
|
+
|
|
48
|
+
var _ref = /*#__PURE__*/_react.default.createElement(_uiGrid.Grid.Col, {
|
|
49
|
+
width: "auto"
|
|
50
|
+
}, /*#__PURE__*/_react.default.createElement(_uiIcons.IconAdminLine, {
|
|
51
|
+
size: "medium"
|
|
52
|
+
}));
|
|
53
|
+
|
|
54
|
+
var RootAccountSharing = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
55
|
+
(0, _inherits2.default)(RootAccountSharing, _Component);
|
|
56
|
+
|
|
57
|
+
var _super = (0, _createSuper2.default)(RootAccountSharing);
|
|
58
|
+
|
|
59
|
+
function RootAccountSharing() {
|
|
60
|
+
var _this;
|
|
61
|
+
|
|
62
|
+
(0, _classCallCheck2.default)(this, RootAccountSharing);
|
|
63
|
+
|
|
64
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
65
|
+
args[_key] = arguments[_key];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
69
|
+
|
|
70
|
+
_this.isSharedWithAccount = function () {
|
|
71
|
+
return [_quizCommon.READ_ONLY, _quizCommon.CAN_EDIT].includes(_this.props.accountPermission);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return _this;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
(0, _createClass2.default)(RootAccountSharing, [{
|
|
78
|
+
key: "render",
|
|
79
|
+
value: function render() {
|
|
80
|
+
return /*#__PURE__*/_react.default.createElement(_uiView.View, {
|
|
81
|
+
as: "div",
|
|
82
|
+
margin: "0 0 medium 0"
|
|
83
|
+
}, /*#__PURE__*/_react.default.createElement(_uiGrid.Grid, {
|
|
84
|
+
colSpacing: "small"
|
|
85
|
+
}, /*#__PURE__*/_react.default.createElement(_uiGrid.Grid.Row, null, _ref, /*#__PURE__*/_react.default.createElement(_uiGrid.Grid.Col, null, /*#__PURE__*/_react.default.createElement(_uiView.View, {
|
|
86
|
+
as: "div",
|
|
87
|
+
padding: "0 0 x-small 0"
|
|
88
|
+
}, this.props.accountName || (0, _formatMessage.default)('Account')), /*#__PURE__*/_react.default.createElement(_uiCheckbox.Checkbox, {
|
|
89
|
+
label: (0, _formatMessage.default)('Share with Institution'),
|
|
90
|
+
variant: "toggle",
|
|
91
|
+
value: "accountPermission",
|
|
92
|
+
checked: this.isSharedWithAccount(),
|
|
93
|
+
onChange: this.props.onShareChange
|
|
94
|
+
})), this.isSharedWithAccount() && /*#__PURE__*/_react.default.createElement(_uiGrid.Grid.Col, {
|
|
95
|
+
width: "auto"
|
|
96
|
+
}, /*#__PURE__*/_react.default.createElement(_uiSimpleSelect.SimpleSelect, {
|
|
97
|
+
onChange: this.props.onShareTypeChange,
|
|
98
|
+
value: this.props.accountPermission,
|
|
99
|
+
renderLabel: /*#__PURE__*/_react.default.createElement(_uiA11yContent.ScreenReaderContent, null, (0, _formatMessage.default)('Access for account'))
|
|
100
|
+
}, /*#__PURE__*/_react.default.createElement(_uiSimpleSelect.SimpleSelect.Option, {
|
|
101
|
+
id: "sharing-modal-account-perm-select-option-can-view",
|
|
102
|
+
value: _quizCommon.READ_ONLY
|
|
103
|
+
}, (0, _formatMessage.default)('Can view')), /*#__PURE__*/_react.default.createElement(_uiSimpleSelect.SimpleSelect.Option, {
|
|
104
|
+
id: "sharing-modal-account-perm-select-option-can-edit",
|
|
105
|
+
value: _quizCommon.CAN_EDIT
|
|
106
|
+
}, (0, _formatMessage.default)('Can edit')))))));
|
|
107
|
+
}
|
|
108
|
+
}]);
|
|
109
|
+
RootAccountSharing.displayName = "RootAccountSharing";
|
|
110
|
+
return RootAccountSharing;
|
|
111
|
+
}(_react.Component), _class2.propTypes = {
|
|
112
|
+
accountName: _propTypes.default.string.isRequired,
|
|
113
|
+
onShareChange: _propTypes.default.func.isRequired,
|
|
114
|
+
onShareTypeChange: _propTypes.default.func.isRequired,
|
|
115
|
+
accountPermission: _propTypes.default.string
|
|
116
|
+
}, _class2.defaultProps = {
|
|
117
|
+
accountPermission: null
|
|
118
|
+
}, _temp)) || _class);
|
|
119
|
+
exports.RootAccountSharing = RootAccountSharing;
|
|
120
|
+
var _default = RootAccountSharing;
|
|
121
|
+
exports.default = _default;
|
|
@@ -41,6 +41,8 @@ var _emotion = require("@instructure/emotion");
|
|
|
41
41
|
|
|
42
42
|
var _index = require("../ContextualIconButton/index.js");
|
|
43
43
|
|
|
44
|
+
var _RootAccountSharing = _interopRequireDefault(require("../RootAccountSharing.js"));
|
|
45
|
+
|
|
44
46
|
var _uiSimpleSelect = require("@instructure/ui-simple-select");
|
|
45
47
|
|
|
46
48
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
@@ -176,6 +178,8 @@ var ShareList = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_cl
|
|
|
176
178
|
}, {
|
|
177
179
|
key: "render",
|
|
178
180
|
value: function render() {
|
|
181
|
+
var _this$props$currentUs;
|
|
182
|
+
|
|
179
183
|
var _this$props = this.props,
|
|
180
184
|
shares = _this$props.shares,
|
|
181
185
|
subAccountBankSharingEnabled = _this$props.subAccountBankSharingEnabled;
|
|
@@ -225,13 +229,25 @@ var ShareList = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_cl
|
|
|
225
229
|
lineHeight: "double"
|
|
226
230
|
}, (0, _formatMessage.default)('Currently shared with')), (0, _emotion.jsx)(_uiGrid.Grid, {
|
|
227
231
|
vAlign: "middle"
|
|
228
|
-
}, existingCourses.map(this.renderEntity))))
|
|
232
|
+
}, existingCourses.map(this.renderEntity))), subAccountBankSharingEnabled && (0, _emotion.jsx)(_uiTabs.Tabs.Panel, {
|
|
233
|
+
renderTitle: (0, _formatMessage.default)('Accounts'),
|
|
234
|
+
isSelected: this.state.selectedTabIndex === 2,
|
|
235
|
+
padding: "large small small small"
|
|
236
|
+
}, ((_this$props$currentUs = this.props.currentUser) === null || _this$props$currentUs === void 0 ? void 0 : _this$props$currentUs.bank_admin) && (0, _emotion.jsx)(_RootAccountSharing.default, {
|
|
237
|
+
accountName: this.props.accountName,
|
|
238
|
+
onShareChange: this.props.onToggleAccountShare,
|
|
239
|
+
onShareTypeChange: this.props.onAccountPermissionChange,
|
|
240
|
+
accountPermission: this.props.accountPermission
|
|
241
|
+
})))));
|
|
229
242
|
}
|
|
230
243
|
}]);
|
|
231
244
|
ShareList.displayName = "ShareList";
|
|
232
245
|
return ShareList;
|
|
233
246
|
}(_react.Component), _class2.propTypes = {
|
|
234
247
|
canEdit: _propTypes.default.bool.isRequired,
|
|
248
|
+
currentUser: _propTypes.default.shape({
|
|
249
|
+
bank_admin: _propTypes.default.bool
|
|
250
|
+
}),
|
|
235
251
|
improvedBankSharingEnabled: _propTypes.default.bool.isRequired,
|
|
236
252
|
newEntities: _reactImmutableProptypes.default.list,
|
|
237
253
|
onEntityRemove: _propTypes.default.func.isRequired,
|
|
@@ -248,8 +264,15 @@ var ShareList = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_cl
|
|
|
248
264
|
})).isRequired,
|
|
249
265
|
subAccountBankSharingEnabled: _propTypes.default.bool.isRequired,
|
|
250
266
|
// eslint-disable-next-line react/require-default-props,react/forbid-prop-types
|
|
251
|
-
styles: _propTypes.default.object
|
|
267
|
+
styles: _propTypes.default.object,
|
|
268
|
+
accountName: _propTypes.default.string,
|
|
269
|
+
onAccountPermissionChange: _propTypes.default.func.isRequired,
|
|
270
|
+
onToggleAccountShare: _propTypes.default.func.isRequired,
|
|
271
|
+
accountPermission: _propTypes.default.string
|
|
252
272
|
}, _class2.defaultProps = {
|
|
273
|
+
accountName: (0, _formatMessage.default)('Account'),
|
|
274
|
+
accountPermission: null,
|
|
275
|
+
currentUser: null,
|
|
253
276
|
newEntities: (0, _immutable.List)(),
|
|
254
277
|
sharedBanks: (0, _immutable.List)()
|
|
255
278
|
}, _temp)) || _class);
|
|
@@ -464,6 +464,14 @@ var SharingModalPresenter = (_dec = (0, _emotion.withStyle)(_styles.default, _th
|
|
|
464
464
|
accountPermission: nextProps.bank.accountPermission,
|
|
465
465
|
shares: nextProps.sharedBanks
|
|
466
466
|
});
|
|
467
|
+
}
|
|
468
|
+
}, {
|
|
469
|
+
key: "componentDidUpdate",
|
|
470
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
471
|
+
if (this.props.subAccountBankSharingEnabled && this.state.accountPermission !== prevState.accountPermission && this.state.accountPermission !== this.props.bank.accountPermission) {
|
|
472
|
+
var updatedBank = this.props.bank.set('accountPermission', this.state.accountPermission);
|
|
473
|
+
this.props.updateBank(updatedBank, false);
|
|
474
|
+
}
|
|
467
475
|
} // =============
|
|
468
476
|
// HELPERS
|
|
469
477
|
// =============
|
|
@@ -523,12 +531,17 @@ var SharingModalPresenter = (_dec = (0, _emotion.withStyle)(_styles.default, _th
|
|
|
523
531
|
key: "renderEntitiesSection",
|
|
524
532
|
value: function renderEntitiesSection() {
|
|
525
533
|
return (0, _emotion.jsx)(_index.default, {
|
|
534
|
+
accountName: this.props.currentUser.account_name,
|
|
535
|
+
accountPermission: this.state.accountPermission,
|
|
526
536
|
canEdit: this.props.bank.canEdit(),
|
|
537
|
+
currentUser: this.props.currentUser,
|
|
527
538
|
entitiesWithChangedPermission: this.state.entitiesWithChangedPermission,
|
|
528
539
|
improvedBankSharingEnabled: this.props.improvedBankSharingEnabled,
|
|
529
540
|
newEntities: this.state.newEntities,
|
|
541
|
+
onAccountPermissionChange: this.handleAccountPermissionChange,
|
|
530
542
|
onEntityRemove: this.handleEntityRemove,
|
|
531
543
|
onPermissionChange: this.handleEntityPermissionChange,
|
|
544
|
+
onToggleAccountShare: this.toggleAccountShare,
|
|
532
545
|
ref: this.handleShareListRef,
|
|
533
546
|
renderSearchSection: this.renderSearchSection // searchPermission and searchSelection are not used directly by ShareList,
|
|
534
547
|
// but are needed as props so that AsyncSearch/Select rerenders when those values change
|
|
@@ -43,7 +43,6 @@ function mapStateToProps(state, props) {
|
|
|
43
43
|
var mapDispatchToProps = {
|
|
44
44
|
closeModal: _modal.closeModal,
|
|
45
45
|
changeItemFeedback: _modifications.changeItemFeedback,
|
|
46
|
-
openModal: _modal.openModal,
|
|
47
46
|
setUi: _ui.set
|
|
48
47
|
};
|
|
49
48
|
var ItemFeedbackModal = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_presenter.ItemFeedbackModal);
|