@instructure/quiz-core 21.0.1-rc.22 → 21.0.1-rc.26

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.
@@ -89,6 +89,7 @@ export var Collection = (_dec = withStyleOverrides(generateStyle, generateCompon
89
89
  }, _this3.props.renderSidebarItem(item, displayPosition, sidebarOpen));
90
90
  });
91
91
  var transitionType = isShowingItems ? 'slide-down' : 'slide-up';
92
+ var screenReaderText = this.props.isPassage ? t('Collapse passage questions') : t('Collapse stimulus questions');
92
93
  return jsx(Transition, {
93
94
  "in": isShowingItems || this.shouldDisplayAllItems(),
94
95
  type: transitionType
@@ -100,7 +101,7 @@ export var Collection = (_dec = withStyleOverrides(generateStyle, generateCompon
100
101
  withBackground: false,
101
102
  withBorder: false,
102
103
  renderIcon: IconArrowOpenUpLine,
103
- screenReaderLabel: t('Collapse stimulus questions')
104
+ screenReaderLabel: screenReaderText
104
105
  })), jsx("div", null, itemComponents)));
105
106
  }
106
107
  }, {
@@ -111,6 +112,7 @@ export var Collection = (_dec = withStyleOverrides(generateStyle, generateCompon
111
112
  itemCollection = _this$props2.itemCollection,
112
113
  isShowingItems = _this$props2.isShowingItems;
113
114
  var transitionType = !isShowingItems ? 'slide-up' : 'slide-down';
115
+ var screenReaderText = this.props.isPassage ? t('Expand passage questions') : t('Expand stimulus questions');
114
116
  return jsx(Transition, {
115
117
  "in": !isShowingItems,
116
118
  type: transitionType
@@ -124,7 +126,7 @@ export var Collection = (_dec = withStyleOverrides(generateStyle, generateCompon
124
126
  withBackground: false,
125
127
  withBorder: false,
126
128
  renderIcon: IconArrowOpenDownLine,
127
- screenReaderLabel: t('Expand stimulus questions')
129
+ screenReaderLabel: screenReaderText
128
130
  })));
129
131
  }
130
132
  }, {
@@ -155,7 +157,8 @@ export var Collection = (_dec = withStyleOverrides(generateStyle, generateCompon
155
157
  // set in connect
156
158
  setSidebarStimulusIsShowing: PropTypes.func.isRequired,
157
159
  styles: PropTypes.object,
158
- makeStyles: PropTypes.func
160
+ makeStyles: PropTypes.func,
161
+ isPassage: PropTypes.bool
159
162
  }), _defineProperty(_Collection, "defaultProps", {
160
163
  isShowingItems: false
161
164
  }), _Collection)) || _class);
@@ -67,6 +67,7 @@ export var SidebarStimulus = (_dec = withStyleOverrides(generateStyle, generateC
67
67
  }, {
68
68
  key: "renderCollection",
69
69
  value: function renderCollection() {
70
+ var _this$props$stimulus;
70
71
  if (this.props.isDragging) {
71
72
  return;
72
73
  }
@@ -83,7 +84,8 @@ export var SidebarStimulus = (_dec = withStyleOverrides(generateStyle, generateC
83
84
  itemCollection: this.props.childEntries,
84
85
  renderSidebarItem: renderSidebarItem,
85
86
  sidebarOpen: sidebarOpen,
86
- stimulusId: this.props.stimulus.id
87
+ stimulusId: this.props.stimulus.id,
88
+ isPassage: (_this$props$stimulus = this.props.stimulus) === null || _this$props$stimulus === void 0 ? void 0 : _this$props$stimulus.isPassage
87
89
  });
88
90
  }
89
91
  }, {
@@ -91,9 +91,9 @@ export var SessionItemResult = (_dec = withStyleOverrides(generateStyle, generat
91
91
  return typeof this.pointsPossible === 'number';
92
92
  }
93
93
  }, {
94
- key: "position",
95
- value: function position() {
96
- return this.props.sessionItem.position;
94
+ key: "questionNumber",
95
+ value: function questionNumber() {
96
+ return this.props.sessionItem.questionNumber;
97
97
  }
98
98
  }, {
99
99
  key: "unscorable",
@@ -179,38 +179,38 @@ export var SessionItemResult = (_dec = withStyleOverrides(generateStyle, generat
179
179
  value: function renderHeader() {
180
180
  return jsx("div", {
181
181
  css: this.props.styles.sessionItemResultHeader
182
- }, this.renderResultPosition(), !this.props.restrictQuantitativeData && (this.hasRegradeInfo() ? this.renderRegradePoints() : this.renderPoints()));
182
+ }, this.renderResultQuestionNumber(), !this.props.restrictQuantitativeData && (this.hasRegradeInfo() ? this.renderRegradePoints() : this.renderPoints()));
183
183
  }
184
184
  }, {
185
- key: "renderResultPosition",
186
- value: function renderResultPosition() {
187
- var position = this.position();
188
- var positionText;
185
+ key: "renderResultQuestionNumber",
186
+ value: function renderResultQuestionNumber() {
187
+ var questionNumber = this.questionNumber();
188
+ var questionNumberText;
189
189
  if (this.regraded() && this.unscorable()) {
190
- positionText = t('Results for question {position, number}. There was a problem grading this question. This question has been regraded.', {
191
- position: position
190
+ questionNumberText = t('Results for question {questionNumber, number}. There was a problem grading this question. This question has been regraded.', {
191
+ questionNumber: questionNumber
192
192
  });
193
193
  } else if (this.regraded()) {
194
- positionText = t('Results for question {position, number}. This question has been regraded.', {
195
- position: position
194
+ questionNumberText = t('Results for question {questionNumber, number}. This question has been regraded.', {
195
+ questionNumber: questionNumber
196
196
  });
197
197
  } else if (this.unscorable() && this.props.editGraderFeedback) {
198
- positionText = t('Results for question {position, number}. There was a problem grading this question.', {
199
- position: position
198
+ questionNumberText = t('Results for question {questionNumber, number}. There was a problem grading this question.', {
199
+ questionNumber: questionNumber
200
200
  });
201
201
  } else if (this.unscorable()) {
202
- positionText = t('Results for question {position, number}. There was a problem grading this question. Please inform your instructor.', {
203
- position: position
202
+ questionNumberText = t('Results for question {questionNumber, number}. There was a problem grading this question. Please inform your instructor.', {
203
+ questionNumber: questionNumber
204
204
  });
205
205
  } else {
206
- positionText = t('Results for question {position, number}.', {
207
- position: position
206
+ questionNumberText = t('Results for question {questionNumber, number}.', {
207
+ questionNumber: questionNumber
208
208
  });
209
209
  }
210
210
  return jsx(PositionBox, {
211
- position: position,
211
+ position: questionNumber,
212
212
  headingLevel: "h3",
213
- headingText: positionText
213
+ headingText: questionNumberText
214
214
  });
215
215
  }
216
216
  }, {
@@ -145,73 +145,74 @@ export var StimulusEdit = (_dec = withStyleOverrides(generateStyle, generateComp
145
145
  });
146
146
  _defineProperty(_this2, "onSubmit", /*#__PURE__*/function () {
147
147
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(e) {
148
- var _this2$props2, stimulus, workingStimulus, quizId, quizEntry, stimulusData;
148
+ var _this2$props2, stimulus, workingStimulus, quizId, quizEntry, message, stimulusData;
149
149
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
150
150
  while (1) switch (_context2.prev = _context2.next) {
151
151
  case 0:
152
152
  _this2$props2 = _this2.props, stimulus = _this2$props2.stimulus, workingStimulus = _this2$props2.workingStimulus, quizId = _this2$props2.quizId, quizEntry = _this2$props2.quizEntry;
153
153
  if (workingStimulus.isValid()) {
154
- _context2.next = 8;
154
+ _context2.next = 9;
155
155
  break;
156
156
  }
157
- _context2.next = 4;
157
+ message = _this2.isPassage() ? t('Passage not saved due to validation errors with the data.') : t('Stimulus not saved due to validation errors with the data.');
158
+ _context2.next = 5;
158
159
  return _this2.props.showError(_this2.props.guid);
159
- case 4:
160
- _this2.props.screenreaderNotification(t('Simulus not saved due to validation errors with the data.'));
160
+ case 5:
161
+ _this2.props.screenreaderNotification(message);
161
162
  _this2.props.clearNextQuizEntry();
162
163
  _this2.focusFirstErrorField();
163
164
  return _context2.abrupt("return");
164
- case 8:
165
+ case 9:
165
166
  _this2.setState({
166
167
  canSubmit: false
167
168
  });
168
169
  _this2.props.hideError(_this2.props.guid);
169
- _context2.prev = 10;
170
+ _context2.prev = 11;
170
171
  if (!stimulus.isTemporary()) {
171
- _context2.next = 17;
172
+ _context2.next = 18;
172
173
  break;
173
174
  }
174
- _context2.next = 14;
175
+ _context2.next = 15;
175
176
  return _this2.props.createStimulusAndQuizEntry(quizId, workingStimulus.toJS(), quizEntry);
176
- case 14:
177
+ case 15:
177
178
  _this2.props.clearTemporaryStimulus(quizId);
178
- _context2.next = 28;
179
+ _context2.next = 29;
179
180
  break;
180
- case 17:
181
+ case 18:
181
182
  if (!_this2.props.shouldClone) {
182
- _context2.next = 26;
183
+ _context2.next = 27;
183
184
  break;
184
185
  }
185
- _context2.next = 20;
186
+ _context2.next = 21;
186
187
  return _this2.props.createStimulus(workingStimulus, _this2.props.quizId, 'quiz', workingStimulus.id);
187
- case 20:
188
+ case 21:
188
189
  stimulusData = _context2.sent;
189
- _context2.next = 23;
190
+ _context2.next = 24;
190
191
  return _this2.handleStimulusCreated(stimulusData);
191
- case 23:
192
+ case 24:
192
193
  _this2.props.clearTemporaryStimulus(quizId);
193
- _context2.next = 28;
194
+ _context2.next = 29;
194
195
  break;
195
- case 26:
196
- _context2.next = 28;
196
+ case 27:
197
+ _context2.next = 29;
197
198
  return _this2.props.updateStimulus(workingStimulus.toJS(), quizId);
198
- case 28:
199
- _context2.next = 34;
199
+ case 29:
200
+ _context2.next = 35;
200
201
  break;
201
- case 30:
202
- _context2.prev = 30;
203
- _context2.t0 = _context2["catch"](10);
202
+ case 31:
203
+ _context2.prev = 31;
204
+ _context2.t0 = _context2["catch"](11);
204
205
  _this2.setState({
205
206
  canSubmit: true
206
207
  });
207
208
  throw _context2.t0;
208
- case 34:
209
- _this2.afterSubmit();
210
209
  case 35:
210
+ _this2.afterSubmit();
211
+ case 36:
211
212
  case "end":
212
213
  return _context2.stop();
213
214
  }
214
- }, _callee2, null, [[10, 30]]);
215
+ }, _callee2, null, [[11, 31]]);
215
216
  }));
216
217
  return function (_x2) {
217
218
  return _ref2.apply(this, arguments);
@@ -315,10 +316,11 @@ export var StimulusEdit = (_dec = withStyleOverrides(generateStyle, generateComp
315
316
  }, {
316
317
  key: "afterSubmit",
317
318
  value: function afterSubmit() {
319
+ var message = this.isPassage() ? t('Changes to passage saved.') : t('Changes to stimulus saved.');
318
320
  this.props.switchOffEditing();
319
321
  this.clearModifications();
320
322
  this.props.setUi(SHOULD_CLONE_ITEM, false);
321
- this.props.screenreaderNotification(t('Changes to stimulus saved.'));
323
+ this.props.screenreaderNotification(message);
322
324
  if (this.props.nextQuizEntry) {
323
325
  this.createNextQuizEntry();
324
326
  }
@@ -164,9 +164,10 @@ export var StimulusEditInfo = (_dec = withStyleOverrides(generateStyle, generate
164
164
  var textAreaId = "stimulusBodyEdit_".concat(stimulus.id, "_").concat(this.props.isBankedContent);
165
165
  var stimulusBodyId = "stimulusBodyEdit_".concat(stimulus.id, "_body");
166
166
  var automationPrefix = stimulus.passage ? 'passage' : 'stimulus';
167
+ var message = stimulus.passage ? t('Edit Passage') : t('Edit Stimulus');
167
168
  return jsx(FormFieldGroup, {
168
169
  messages: this.inputErrors('onSelf'),
169
- description: jsx(ScreenReaderContent, null, t('Edit Stimulus'))
170
+ description: jsx(ScreenReaderContent, null, message)
170
171
  }, jsx(Heading, {
171
172
  level: "h3",
172
173
  as: "h2"
@@ -366,51 +366,63 @@ export var QuizEntry = (_dec = withStateCache(function () {
366
366
  // their own possible string so that translators can better translate the meaning
367
367
  var type;
368
368
  if (this.hasStimulus || this.isBank) {
369
+ if (this.isPassage) {
370
+ type = t('Passage');
371
+ var opts = {
372
+ type: type,
373
+ start: displayPosition - 1
374
+ };
375
+ return {
376
+ Remove: t('Remove {type} located after position {start, number}.', opts),
377
+ Edit: t('Edit {type} located after position {start, number}.', opts),
378
+ Move: t('Move {type} located after position {start, number}.', opts)
379
+ }[verb];
380
+ }
369
381
  type = this.hasStimulus ? t('Stimulus') : t('Bank');
370
382
  if (this.numItems > 1) {
371
- var opts = {
383
+ var _opts = {
372
384
  type: type,
373
385
  start: displayPosition,
374
386
  end: displayPosition + this.numItems - 1
375
387
  };
376
388
  return {
377
- Remove: t('Remove {type} containing questions {start, number} through {end, number}.', opts),
378
- Edit: t('Edit {type} containing questions {start, number} through {end, number}.', opts),
379
- Move: t('Move {type} containing questions {start, number} through {end, number}.', opts)
389
+ Remove: t('Remove {type} containing questions {start, number} through {end, number}.', _opts),
390
+ Edit: t('Edit {type} containing questions {start, number} through {end, number}.', _opts),
391
+ Move: t('Move {type} containing questions {start, number} through {end, number}.', _opts)
380
392
  }[verb];
381
393
  } else if (this.numItems === 1) {
382
- var _opts = {
394
+ var _opts2 = {
383
395
  type: type,
384
396
  start: displayPosition
385
397
  };
386
398
  return {
387
- Remove: t('Remove {type} containing question {start, number}.', _opts),
388
- Edit: t('Edit {type} containing question {start, number}.', _opts),
389
- Move: t('Move {type} containing question {start, number}.', _opts)
399
+ Remove: t('Remove {type} containing question {start, number}.', _opts2),
400
+ Edit: t('Edit {type} containing question {start, number}.', _opts2),
401
+ Move: t('Move {type} containing question {start, number}.', _opts2)
390
402
  }[verb];
391
403
  } else {
392
- var _opts2 = {
404
+ var _opts3 = {
393
405
  type: type,
394
406
  start: displayPosition - 1
395
407
  };
396
408
  return {
397
- Remove: t('Remove empty {type} located after position {start, number}.', _opts2),
398
- Edit: t('Edit empty {type} located after position {start, number}.', _opts2),
399
- Move: t('Move empty {type} located after position {start, number}.', _opts2)
409
+ Remove: t('Remove empty {type} located after position {start, number}.', _opts3),
410
+ Edit: t('Edit empty {type} located after position {start, number}.', _opts3),
411
+ Move: t('Move empty {type} located after position {start, number}.', _opts3)
400
412
  }[verb];
401
413
  }
402
414
  } else {
403
415
  type = t('Question');
404
- var _opts3 = {
416
+ var _opts4 = {
405
417
  verb: verb,
406
418
  type: type,
407
419
  position: displayPosition
408
420
  };
409
421
  return {
410
- Remove: t('Remove {type} at position {position, number}.', _opts3),
411
- Edit: t('Edit {type} at position {position, number}.', _opts3),
412
- Move: t('Move {type} at position {position, number}.', _opts3),
413
- Copy: t('Copy {type} at position {position, number}.', _opts3)
422
+ Remove: t('Remove {type} at position {position, number}.', _opts4),
423
+ Edit: t('Edit {type} at position {position, number}.', _opts4),
424
+ Move: t('Move {type} at position {position, number}.', _opts4),
425
+ Copy: t('Copy {type} at position {position, number}.', _opts4)
414
426
  }[verb];
415
427
  }
416
428
  }
@@ -85,6 +85,11 @@ export var SessionItem = /*#__PURE__*/function (_ReduxRecord) {
85
85
  get: function get() {
86
86
  return this.type === 'Stimulus';
87
87
  }
88
+ }, {
89
+ key: "isPassage",
90
+ get: function get() {
91
+ return this.isStimulus && this.stimulusRecord.isPassage;
92
+ }
88
93
  }, {
89
94
  key: "stimulusRecord",
90
95
  get: function get() {
@@ -123,6 +128,7 @@ export var SessionItem = /*#__PURE__*/function (_ReduxRecord) {
123
128
  item: {},
124
129
  pointsPossible: null,
125
130
  position: null,
131
+ questionNumber: null,
126
132
  quizEntryId: null,
127
133
  quizSessionId: null,
128
134
  scoringData: {},
@@ -211,7 +211,7 @@ var __remainingQuestionPositions = function __remainingQuestionPositions(session
211
211
  var itemUserResponse = __getResponseForSessionItem(si, responses);
212
212
  return item.hasResponse(itemUserResponse);
213
213
  }).map(function (si) {
214
- return si.get('position');
214
+ return si.get('questionNumber');
215
215
  }).toSet().toJS();
216
216
  };
217
217
  export function showSubmitConfirmModal(quizSessionId) {
@@ -96,6 +96,7 @@ var Collection = exports.Collection = (_dec = (0, _quizCommon.withStyleOverrides
96
96
  }, _this3.props.renderSidebarItem(item, displayPosition, sidebarOpen));
97
97
  });
98
98
  var transitionType = isShowingItems ? 'slide-down' : 'slide-up';
99
+ var screenReaderText = this.props.isPassage ? (0, _formatMessage["default"])('Collapse passage questions') : (0, _formatMessage["default"])('Collapse stimulus questions');
99
100
  return (0, _emotion.jsx)(_uiMotion.Transition, {
100
101
  "in": isShowingItems || this.shouldDisplayAllItems(),
101
102
  type: transitionType
@@ -107,7 +108,7 @@ var Collection = exports.Collection = (_dec = (0, _quizCommon.withStyleOverrides
107
108
  withBackground: false,
108
109
  withBorder: false,
109
110
  renderIcon: _uiIcons.IconArrowOpenUpLine,
110
- screenReaderLabel: (0, _formatMessage["default"])('Collapse stimulus questions')
111
+ screenReaderLabel: screenReaderText
111
112
  })), (0, _emotion.jsx)("div", null, itemComponents)));
112
113
  }
113
114
  }, {
@@ -118,6 +119,7 @@ var Collection = exports.Collection = (_dec = (0, _quizCommon.withStyleOverrides
118
119
  itemCollection = _this$props2.itemCollection,
119
120
  isShowingItems = _this$props2.isShowingItems;
120
121
  var transitionType = !isShowingItems ? 'slide-up' : 'slide-down';
122
+ var screenReaderText = this.props.isPassage ? (0, _formatMessage["default"])('Expand passage questions') : (0, _formatMessage["default"])('Expand stimulus questions');
121
123
  return (0, _emotion.jsx)(_uiMotion.Transition, {
122
124
  "in": !isShowingItems,
123
125
  type: transitionType
@@ -131,7 +133,7 @@ var Collection = exports.Collection = (_dec = (0, _quizCommon.withStyleOverrides
131
133
  withBackground: false,
132
134
  withBorder: false,
133
135
  renderIcon: _uiIcons.IconArrowOpenDownLine,
134
- screenReaderLabel: (0, _formatMessage["default"])('Expand stimulus questions')
136
+ screenReaderLabel: screenReaderText
135
137
  })));
136
138
  }
137
139
  }, {
@@ -162,7 +164,8 @@ var Collection = exports.Collection = (_dec = (0, _quizCommon.withStyleOverrides
162
164
  // set in connect
163
165
  setSidebarStimulusIsShowing: _propTypes["default"].func.isRequired,
164
166
  styles: _propTypes["default"].object,
165
- makeStyles: _propTypes["default"].func
167
+ makeStyles: _propTypes["default"].func,
168
+ isPassage: _propTypes["default"].bool
166
169
  }), (0, _defineProperty2["default"])(_Collection, "defaultProps", {
167
170
  isShowingItems: false
168
171
  }), _Collection)) || _class);
@@ -74,6 +74,7 @@ var SidebarStimulus = exports.SidebarStimulus = (_dec = (0, _quizCommon.withStyl
74
74
  }, {
75
75
  key: "renderCollection",
76
76
  value: function renderCollection() {
77
+ var _this$props$stimulus;
77
78
  if (this.props.isDragging) {
78
79
  return;
79
80
  }
@@ -90,7 +91,8 @@ var SidebarStimulus = exports.SidebarStimulus = (_dec = (0, _quizCommon.withStyl
90
91
  itemCollection: this.props.childEntries,
91
92
  renderSidebarItem: renderSidebarItem,
92
93
  sidebarOpen: sidebarOpen,
93
- stimulusId: this.props.stimulus.id
94
+ stimulusId: this.props.stimulus.id,
95
+ isPassage: (_this$props$stimulus = this.props.stimulus) === null || _this$props$stimulus === void 0 ? void 0 : _this$props$stimulus.isPassage
94
96
  });
95
97
  }
96
98
  }, {
@@ -98,9 +98,9 @@ var SessionItemResult = exports.SessionItemResult = (_dec = (0, _quizCommon.with
98
98
  return typeof this.pointsPossible === 'number';
99
99
  }
100
100
  }, {
101
- key: "position",
102
- value: function position() {
103
- return this.props.sessionItem.position;
101
+ key: "questionNumber",
102
+ value: function questionNumber() {
103
+ return this.props.sessionItem.questionNumber;
104
104
  }
105
105
  }, {
106
106
  key: "unscorable",
@@ -186,38 +186,38 @@ var SessionItemResult = exports.SessionItemResult = (_dec = (0, _quizCommon.with
186
186
  value: function renderHeader() {
187
187
  return (0, _emotion.jsx)("div", {
188
188
  css: this.props.styles.sessionItemResultHeader
189
- }, this.renderResultPosition(), !this.props.restrictQuantitativeData && (this.hasRegradeInfo() ? this.renderRegradePoints() : this.renderPoints()));
189
+ }, this.renderResultQuestionNumber(), !this.props.restrictQuantitativeData && (this.hasRegradeInfo() ? this.renderRegradePoints() : this.renderPoints()));
190
190
  }
191
191
  }, {
192
- key: "renderResultPosition",
193
- value: function renderResultPosition() {
194
- var position = this.position();
195
- var positionText;
192
+ key: "renderResultQuestionNumber",
193
+ value: function renderResultQuestionNumber() {
194
+ var questionNumber = this.questionNumber();
195
+ var questionNumberText;
196
196
  if (this.regraded() && this.unscorable()) {
197
- positionText = (0, _formatMessage["default"])('Results for question {position, number}. There was a problem grading this question. This question has been regraded.', {
198
- position: position
197
+ questionNumberText = (0, _formatMessage["default"])('Results for question {questionNumber, number}. There was a problem grading this question. This question has been regraded.', {
198
+ questionNumber: questionNumber
199
199
  });
200
200
  } else if (this.regraded()) {
201
- positionText = (0, _formatMessage["default"])('Results for question {position, number}. This question has been regraded.', {
202
- position: position
201
+ questionNumberText = (0, _formatMessage["default"])('Results for question {questionNumber, number}. This question has been regraded.', {
202
+ questionNumber: questionNumber
203
203
  });
204
204
  } else if (this.unscorable() && this.props.editGraderFeedback) {
205
- positionText = (0, _formatMessage["default"])('Results for question {position, number}. There was a problem grading this question.', {
206
- position: position
205
+ questionNumberText = (0, _formatMessage["default"])('Results for question {questionNumber, number}. There was a problem grading this question.', {
206
+ questionNumber: questionNumber
207
207
  });
208
208
  } else if (this.unscorable()) {
209
- positionText = (0, _formatMessage["default"])('Results for question {position, number}. There was a problem grading this question. Please inform your instructor.', {
210
- position: position
209
+ questionNumberText = (0, _formatMessage["default"])('Results for question {questionNumber, number}. There was a problem grading this question. Please inform your instructor.', {
210
+ questionNumber: questionNumber
211
211
  });
212
212
  } else {
213
- positionText = (0, _formatMessage["default"])('Results for question {position, number}.', {
214
- position: position
213
+ questionNumberText = (0, _formatMessage["default"])('Results for question {questionNumber, number}.', {
214
+ questionNumber: questionNumber
215
215
  });
216
216
  }
217
217
  return (0, _emotion.jsx)(_PositionBox["default"], {
218
- position: position,
218
+ position: questionNumber,
219
219
  headingLevel: "h3",
220
- headingText: positionText
220
+ headingText: questionNumberText
221
221
  });
222
222
  }
223
223
  }, {
@@ -152,73 +152,74 @@ var StimulusEdit = exports.StimulusEdit = (_dec = (0, _quizCommon.withStyleOverr
152
152
  });
153
153
  (0, _defineProperty2["default"])(_this2, "onSubmit", /*#__PURE__*/function () {
154
154
  var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(e) {
155
- var _this2$props2, stimulus, workingStimulus, quizId, quizEntry, stimulusData;
155
+ var _this2$props2, stimulus, workingStimulus, quizId, quizEntry, message, stimulusData;
156
156
  return _regenerator["default"].wrap(function _callee2$(_context2) {
157
157
  while (1) switch (_context2.prev = _context2.next) {
158
158
  case 0:
159
159
  _this2$props2 = _this2.props, stimulus = _this2$props2.stimulus, workingStimulus = _this2$props2.workingStimulus, quizId = _this2$props2.quizId, quizEntry = _this2$props2.quizEntry;
160
160
  if (workingStimulus.isValid()) {
161
- _context2.next = 8;
161
+ _context2.next = 9;
162
162
  break;
163
163
  }
164
- _context2.next = 4;
164
+ message = _this2.isPassage() ? (0, _formatMessage["default"])('Passage not saved due to validation errors with the data.') : (0, _formatMessage["default"])('Stimulus not saved due to validation errors with the data.');
165
+ _context2.next = 5;
165
166
  return _this2.props.showError(_this2.props.guid);
166
- case 4:
167
- _this2.props.screenreaderNotification((0, _formatMessage["default"])('Simulus not saved due to validation errors with the data.'));
167
+ case 5:
168
+ _this2.props.screenreaderNotification(message);
168
169
  _this2.props.clearNextQuizEntry();
169
170
  _this2.focusFirstErrorField();
170
171
  return _context2.abrupt("return");
171
- case 8:
172
+ case 9:
172
173
  _this2.setState({
173
174
  canSubmit: false
174
175
  });
175
176
  _this2.props.hideError(_this2.props.guid);
176
- _context2.prev = 10;
177
+ _context2.prev = 11;
177
178
  if (!stimulus.isTemporary()) {
178
- _context2.next = 17;
179
+ _context2.next = 18;
179
180
  break;
180
181
  }
181
- _context2.next = 14;
182
+ _context2.next = 15;
182
183
  return _this2.props.createStimulusAndQuizEntry(quizId, workingStimulus.toJS(), quizEntry);
183
- case 14:
184
+ case 15:
184
185
  _this2.props.clearTemporaryStimulus(quizId);
185
- _context2.next = 28;
186
+ _context2.next = 29;
186
187
  break;
187
- case 17:
188
+ case 18:
188
189
  if (!_this2.props.shouldClone) {
189
- _context2.next = 26;
190
+ _context2.next = 27;
190
191
  break;
191
192
  }
192
- _context2.next = 20;
193
+ _context2.next = 21;
193
194
  return _this2.props.createStimulus(workingStimulus, _this2.props.quizId, 'quiz', workingStimulus.id);
194
- case 20:
195
+ case 21:
195
196
  stimulusData = _context2.sent;
196
- _context2.next = 23;
197
+ _context2.next = 24;
197
198
  return _this2.handleStimulusCreated(stimulusData);
198
- case 23:
199
+ case 24:
199
200
  _this2.props.clearTemporaryStimulus(quizId);
200
- _context2.next = 28;
201
+ _context2.next = 29;
201
202
  break;
202
- case 26:
203
- _context2.next = 28;
203
+ case 27:
204
+ _context2.next = 29;
204
205
  return _this2.props.updateStimulus(workingStimulus.toJS(), quizId);
205
- case 28:
206
- _context2.next = 34;
206
+ case 29:
207
+ _context2.next = 35;
207
208
  break;
208
- case 30:
209
- _context2.prev = 30;
210
- _context2.t0 = _context2["catch"](10);
209
+ case 31:
210
+ _context2.prev = 31;
211
+ _context2.t0 = _context2["catch"](11);
211
212
  _this2.setState({
212
213
  canSubmit: true
213
214
  });
214
215
  throw _context2.t0;
215
- case 34:
216
- _this2.afterSubmit();
217
216
  case 35:
217
+ _this2.afterSubmit();
218
+ case 36:
218
219
  case "end":
219
220
  return _context2.stop();
220
221
  }
221
- }, _callee2, null, [[10, 30]]);
222
+ }, _callee2, null, [[11, 31]]);
222
223
  }));
223
224
  return function (_x2) {
224
225
  return _ref2.apply(this, arguments);
@@ -322,10 +323,11 @@ var StimulusEdit = exports.StimulusEdit = (_dec = (0, _quizCommon.withStyleOverr
322
323
  }, {
323
324
  key: "afterSubmit",
324
325
  value: function afterSubmit() {
326
+ var message = this.isPassage() ? (0, _formatMessage["default"])('Changes to passage saved.') : (0, _formatMessage["default"])('Changes to stimulus saved.');
325
327
  this.props.switchOffEditing();
326
328
  this.clearModifications();
327
329
  this.props.setUi(_quizCommon.SHOULD_CLONE_ITEM, false);
328
- this.props.screenreaderNotification((0, _formatMessage["default"])('Changes to stimulus saved.'));
330
+ this.props.screenreaderNotification(message);
329
331
  if (this.props.nextQuizEntry) {
330
332
  this.createNextQuizEntry();
331
333
  }
@@ -171,9 +171,10 @@ var StimulusEditInfo = exports.StimulusEditInfo = (_dec = (0, _quizCommon.withSt
171
171
  var textAreaId = "stimulusBodyEdit_".concat(stimulus.id, "_").concat(this.props.isBankedContent);
172
172
  var stimulusBodyId = "stimulusBodyEdit_".concat(stimulus.id, "_body");
173
173
  var automationPrefix = stimulus.passage ? 'passage' : 'stimulus';
174
+ var message = stimulus.passage ? (0, _formatMessage["default"])('Edit Passage') : (0, _formatMessage["default"])('Edit Stimulus');
174
175
  return (0, _emotion.jsx)(_quizCommon.FormFieldGroup, {
175
176
  messages: this.inputErrors('onSelf'),
176
- description: (0, _emotion.jsx)(_uiA11yContent.ScreenReaderContent, null, (0, _formatMessage["default"])('Edit Stimulus'))
177
+ description: (0, _emotion.jsx)(_uiA11yContent.ScreenReaderContent, null, message)
177
178
  }, (0, _emotion.jsx)(_uiHeading.Heading, {
178
179
  level: "h3",
179
180
  as: "h2"
@@ -375,51 +375,63 @@ var QuizEntry = exports.QuizEntry = (_dec = (0, _withStateCache["default"])(func
375
375
  // their own possible string so that translators can better translate the meaning
376
376
  var type;
377
377
  if (this.hasStimulus || this.isBank) {
378
+ if (this.isPassage) {
379
+ type = (0, _formatMessage["default"])('Passage');
380
+ var opts = {
381
+ type: type,
382
+ start: displayPosition - 1
383
+ };
384
+ return {
385
+ Remove: (0, _formatMessage["default"])('Remove {type} located after position {start, number}.', opts),
386
+ Edit: (0, _formatMessage["default"])('Edit {type} located after position {start, number}.', opts),
387
+ Move: (0, _formatMessage["default"])('Move {type} located after position {start, number}.', opts)
388
+ }[verb];
389
+ }
378
390
  type = this.hasStimulus ? (0, _formatMessage["default"])('Stimulus') : (0, _formatMessage["default"])('Bank');
379
391
  if (this.numItems > 1) {
380
- var opts = {
392
+ var _opts = {
381
393
  type: type,
382
394
  start: displayPosition,
383
395
  end: displayPosition + this.numItems - 1
384
396
  };
385
397
  return {
386
- Remove: (0, _formatMessage["default"])('Remove {type} containing questions {start, number} through {end, number}.', opts),
387
- Edit: (0, _formatMessage["default"])('Edit {type} containing questions {start, number} through {end, number}.', opts),
388
- Move: (0, _formatMessage["default"])('Move {type} containing questions {start, number} through {end, number}.', opts)
398
+ Remove: (0, _formatMessage["default"])('Remove {type} containing questions {start, number} through {end, number}.', _opts),
399
+ Edit: (0, _formatMessage["default"])('Edit {type} containing questions {start, number} through {end, number}.', _opts),
400
+ Move: (0, _formatMessage["default"])('Move {type} containing questions {start, number} through {end, number}.', _opts)
389
401
  }[verb];
390
402
  } else if (this.numItems === 1) {
391
- var _opts = {
403
+ var _opts2 = {
392
404
  type: type,
393
405
  start: displayPosition
394
406
  };
395
407
  return {
396
- Remove: (0, _formatMessage["default"])('Remove {type} containing question {start, number}.', _opts),
397
- Edit: (0, _formatMessage["default"])('Edit {type} containing question {start, number}.', _opts),
398
- Move: (0, _formatMessage["default"])('Move {type} containing question {start, number}.', _opts)
408
+ Remove: (0, _formatMessage["default"])('Remove {type} containing question {start, number}.', _opts2),
409
+ Edit: (0, _formatMessage["default"])('Edit {type} containing question {start, number}.', _opts2),
410
+ Move: (0, _formatMessage["default"])('Move {type} containing question {start, number}.', _opts2)
399
411
  }[verb];
400
412
  } else {
401
- var _opts2 = {
413
+ var _opts3 = {
402
414
  type: type,
403
415
  start: displayPosition - 1
404
416
  };
405
417
  return {
406
- Remove: (0, _formatMessage["default"])('Remove empty {type} located after position {start, number}.', _opts2),
407
- Edit: (0, _formatMessage["default"])('Edit empty {type} located after position {start, number}.', _opts2),
408
- Move: (0, _formatMessage["default"])('Move empty {type} located after position {start, number}.', _opts2)
418
+ Remove: (0, _formatMessage["default"])('Remove empty {type} located after position {start, number}.', _opts3),
419
+ Edit: (0, _formatMessage["default"])('Edit empty {type} located after position {start, number}.', _opts3),
420
+ Move: (0, _formatMessage["default"])('Move empty {type} located after position {start, number}.', _opts3)
409
421
  }[verb];
410
422
  }
411
423
  } else {
412
424
  type = (0, _formatMessage["default"])('Question');
413
- var _opts3 = {
425
+ var _opts4 = {
414
426
  verb: verb,
415
427
  type: type,
416
428
  position: displayPosition
417
429
  };
418
430
  return {
419
- Remove: (0, _formatMessage["default"])('Remove {type} at position {position, number}.', _opts3),
420
- Edit: (0, _formatMessage["default"])('Edit {type} at position {position, number}.', _opts3),
421
- Move: (0, _formatMessage["default"])('Move {type} at position {position, number}.', _opts3),
422
- Copy: (0, _formatMessage["default"])('Copy {type} at position {position, number}.', _opts3)
431
+ Remove: (0, _formatMessage["default"])('Remove {type} at position {position, number}.', _opts4),
432
+ Edit: (0, _formatMessage["default"])('Edit {type} at position {position, number}.', _opts4),
433
+ Move: (0, _formatMessage["default"])('Move {type} at position {position, number}.', _opts4),
434
+ Copy: (0, _formatMessage["default"])('Copy {type} at position {position, number}.', _opts4)
423
435
  }[verb];
424
436
  }
425
437
  }
@@ -92,6 +92,11 @@ var SessionItem = exports.SessionItem = /*#__PURE__*/function (_ReduxRecord) {
92
92
  get: function get() {
93
93
  return this.type === 'Stimulus';
94
94
  }
95
+ }, {
96
+ key: "isPassage",
97
+ get: function get() {
98
+ return this.isStimulus && this.stimulusRecord.isPassage;
99
+ }
95
100
  }, {
96
101
  key: "stimulusRecord",
97
102
  get: function get() {
@@ -130,6 +135,7 @@ var SessionItem = exports.SessionItem = /*#__PURE__*/function (_ReduxRecord) {
130
135
  item: {},
131
136
  pointsPossible: null,
132
137
  position: null,
138
+ questionNumber: null,
133
139
  quizEntryId: null,
134
140
  quizSessionId: null,
135
141
  scoringData: {},
@@ -234,7 +234,7 @@ var __remainingQuestionPositions = function __remainingQuestionPositions(session
234
234
  var itemUserResponse = __getResponseForSessionItem(si, responses);
235
235
  return item.hasResponse(itemUserResponse);
236
236
  }).map(function (si) {
237
- return si.get('position');
237
+ return si.get('questionNumber');
238
238
  }).toSet().toJS();
239
239
  };
240
240
  function showSubmitConfirmModal(quizSessionId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/quiz-core",
3
- "version": "21.0.1-rc.22+82a9a6da7",
3
+ "version": "21.0.1-rc.26+f01600252",
4
4
  "license": "MIT",
5
5
  "description": "The Quiz React SDK by Instructure Inc.",
6
6
  "author": "Instructure, Inc. Engineering and Product Design",
@@ -46,11 +46,11 @@
46
46
  "@instructure/emotion": "10.14.0",
47
47
  "@instructure/grading-utils": "^1.0.0",
48
48
  "@instructure/outcomes-ui": "3.2.3",
49
- "@instructure/quiz-common": "21.0.1-rc.22+82a9a6da7",
50
- "@instructure/quiz-i18n": "21.0.1-rc.22+82a9a6da7",
51
- "@instructure/quiz-interactions": "21.0.1-rc.22+82a9a6da7",
52
- "@instructure/quiz-number-input": "21.0.1-rc.22+82a9a6da7",
53
- "@instructure/quiz-rce": "21.0.1-rc.22+82a9a6da7",
49
+ "@instructure/quiz-common": "21.0.1-rc.26+f01600252",
50
+ "@instructure/quiz-i18n": "21.0.1-rc.26+f01600252",
51
+ "@instructure/quiz-interactions": "21.0.1-rc.26+f01600252",
52
+ "@instructure/quiz-number-input": "21.0.1-rc.26+f01600252",
53
+ "@instructure/quiz-rce": "21.0.1-rc.26+f01600252",
54
54
  "@instructure/ui-a11y-content": "10.14.0",
55
55
  "@instructure/ui-alerts": "10.14.0",
56
56
  "@instructure/ui-avatar": "10.14.0",
@@ -109,7 +109,7 @@
109
109
  "file-saver": "~2.0.5",
110
110
  "humps": "^2.0.0",
111
111
  "immutable": "^3.8.1",
112
- "instructure-validations": "21.0.1-rc.22+82a9a6da7",
112
+ "instructure-validations": "21.0.1-rc.26+f01600252",
113
113
  "ipaddr.js": "^1.5.4",
114
114
  "isomorphic-fetch": "^2.2.0",
115
115
  "isuuid": "^0.1.0",
@@ -158,7 +158,7 @@
158
158
  "jquery": "^2.2.3",
159
159
  "karma-junit-reporter": "^2.0.1",
160
160
  "most-subject": "^5.3.0",
161
- "quiz-presets": "21.0.1-rc.22+82a9a6da7",
161
+ "quiz-presets": "21.0.1-rc.26+f01600252",
162
162
  "react": "^16.8.6",
163
163
  "react-addons-test-utils": "^15.6.2",
164
164
  "react-dom": "^16.8.6",
@@ -174,5 +174,5 @@
174
174
  "publishConfig": {
175
175
  "access": "public"
176
176
  },
177
- "gitHead": "82a9a6da7bf0bf5df739a6bbe5298bfa05e1f6fc"
177
+ "gitHead": "f01600252e7f8eb9fe4c7e2ff816e7c2c1ade1aa"
178
178
  }