@pie-element/drawing-response 3.6.0 → 3.6.1-beta.587

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.
Files changed (87) hide show
  1. package/CHANGELOG.md +507 -0
  2. package/configure/CHANGELOG.md +446 -0
  3. package/configure/lib/button.js.map +1 -1
  4. package/configure/lib/defaults.js +22 -7
  5. package/configure/lib/defaults.js.map +1 -1
  6. package/configure/lib/image-container.js +44 -24
  7. package/configure/lib/image-container.js.map +1 -1
  8. package/configure/lib/index.js +65 -12
  9. package/configure/lib/index.js.map +1 -1
  10. package/configure/lib/root.js +78 -48
  11. package/configure/lib/root.js.map +1 -1
  12. package/configure/package.json +4 -4
  13. package/configure/src/__tests__/__snapshots__/image-container.test.jsx.snap +3 -2
  14. package/configure/src/__tests__/__snapshots__/root.test.jsx.snap +38 -18
  15. package/configure/src/__tests__/image-container.test.jsx +42 -35
  16. package/configure/src/__tests__/index.test.js +7 -7
  17. package/configure/src/__tests__/root.test.jsx +18 -25
  18. package/configure/src/button.jsx +4 -4
  19. package/configure/src/defaults.js +25 -10
  20. package/configure/src/image-container.jsx +80 -59
  21. package/configure/src/index.js +46 -14
  22. package/configure/src/root.jsx +72 -76
  23. package/controller/CHANGELOG.md +58 -0
  24. package/controller/lib/defaults.js.map +1 -1
  25. package/controller/lib/index.js +13 -12
  26. package/controller/lib/index.js.map +1 -1
  27. package/controller/package.json +1 -1
  28. package/controller/src/__tests__/index.test.js +35 -34
  29. package/controller/src/defaults.js +2 -2
  30. package/controller/src/index.js +13 -17
  31. package/docs/config-schema.json +111 -1
  32. package/docs/config-schema.json.md +87 -3
  33. package/docs/demo/config.js +2 -2
  34. package/docs/demo/generate.js +5 -2
  35. package/docs/demo/session.js +4 -4
  36. package/docs/pie-schema.json +70 -6
  37. package/docs/pie-schema.json.md +55 -4
  38. package/lib/drawing-response/button.js.map +1 -1
  39. package/lib/drawing-response/constants.js.map +1 -1
  40. package/lib/drawing-response/container.js +80 -25
  41. package/lib/drawing-response/container.js.map +1 -1
  42. package/lib/drawing-response/drawable-circle.js +1 -1
  43. package/lib/drawing-response/drawable-circle.js.map +1 -1
  44. package/lib/drawing-response/drawable-eraser.js +1 -1
  45. package/lib/drawing-response/drawable-eraser.js.map +1 -1
  46. package/lib/drawing-response/drawable-free-path.js +1 -1
  47. package/lib/drawing-response/drawable-free-path.js.map +1 -1
  48. package/lib/drawing-response/drawable-helper.js.map +1 -1
  49. package/lib/drawing-response/drawable-image.js +1 -0
  50. package/lib/drawing-response/drawable-image.js.map +1 -1
  51. package/lib/drawing-response/drawable-line.js +1 -1
  52. package/lib/drawing-response/drawable-line.js.map +1 -1
  53. package/lib/drawing-response/drawable-main.js +46 -16
  54. package/lib/drawing-response/drawable-main.js.map +1 -1
  55. package/lib/drawing-response/drawable-palette.js +7 -2
  56. package/lib/drawing-response/drawable-palette.js.map +1 -1
  57. package/lib/drawing-response/drawable-rectangle.js +1 -1
  58. package/lib/drawing-response/drawable-rectangle.js.map +1 -1
  59. package/lib/drawing-response/drawable-text.js +15 -5
  60. package/lib/drawing-response/drawable-text.js.map +1 -1
  61. package/lib/drawing-response/drawable-transformer.js +1 -1
  62. package/lib/drawing-response/drawable-transformer.js.map +1 -1
  63. package/lib/drawing-response/factory.js.map +1 -1
  64. package/lib/drawing-response/icon.js.map +1 -1
  65. package/lib/drawing-response/index.js +11 -15
  66. package/lib/drawing-response/index.js.map +1 -1
  67. package/lib/index.js +4 -1
  68. package/lib/index.js.map +1 -1
  69. package/package.json +5 -4
  70. package/src/__tests__/drawing-index-test.jsx +4 -4
  71. package/src/drawing-response/__tests__/__snapshots__/container.test.jsx.snap +174 -290
  72. package/src/drawing-response/__tests__/__snapshots__/drawing-main.test.jsx.snap +26 -2
  73. package/src/drawing-response/__tests__/container.test.jsx +9 -2
  74. package/src/drawing-response/__tests__/drawable-helper.test.jsx +1 -1
  75. package/src/drawing-response/__tests__/drawing-main.test.jsx +74 -86
  76. package/src/drawing-response/button.jsx +5 -8
  77. package/src/drawing-response/constants.js +42 -34
  78. package/src/drawing-response/container.jsx +93 -70
  79. package/src/drawing-response/drawable-image.jsx +5 -4
  80. package/src/drawing-response/drawable-main.jsx +46 -17
  81. package/src/drawing-response/drawable-palette.jsx +18 -35
  82. package/src/drawing-response/drawable-text.jsx +34 -48
  83. package/src/drawing-response/drawable-transformer.jsx +3 -1
  84. package/src/drawing-response/factory.js +3 -11
  85. package/src/drawing-response/icon.jsx +19 -20
  86. package/src/drawing-response/index.jsx +14 -20
  87. package/src/index.js +8 -11
@@ -5,9 +5,10 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
+ exports.createDefaultModel = void 0;
8
9
  exports.model = model;
10
+ exports.normalize = void 0;
9
11
  exports.outcome = outcome;
10
- exports.createDefaultModel = exports.normalize = void 0;
11
12
 
12
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
14
 
@@ -15,18 +16,18 @@ var _debug = _interopRequireDefault(require("debug"));
15
16
 
16
17
  var _defaults = _interopRequireDefault(require("./defaults"));
17
18
 
18
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
19
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
19
20
 
20
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
21
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
21
22
 
22
23
  var log = (0, _debug["default"])('pie-elements:drawing-response:controller');
23
24
 
24
25
  var normalize = function normalize(question) {
25
26
  return _objectSpread({
26
- rationaleEnabled: true,
27
27
  promptEnabled: true,
28
28
  teacherInstructionsEnabled: true,
29
- studentInstructionsEnabled: true
29
+ studentInstructionsEnabled: true,
30
+ backgroundImageEnabled: true
30
31
  }, question);
31
32
  };
32
33
 
@@ -37,22 +38,22 @@ function model(question, session, env) {
37
38
  var imageUrl = normalizedQuestion.imageUrl,
38
39
  imageDimensions = normalizedQuestion.imageDimensions,
39
40
  prompt = normalizedQuestion.prompt,
40
- promptEnabled = normalizedQuestion.promptEnabled;
41
+ promptEnabled = normalizedQuestion.promptEnabled,
42
+ backgroundImageEnabled = normalizedQuestion.backgroundImageEnabled;
41
43
  return new Promise(function (resolve) {
42
44
  var out = {
43
45
  disabled: env.mode !== 'gather',
44
46
  mode: env.mode,
45
47
  imageDimensions: imageDimensions,
46
48
  imageUrl: imageUrl,
47
- prompt: promptEnabled ? prompt : null
49
+ prompt: promptEnabled ? prompt : null,
50
+ backgroundImageEnabled: backgroundImageEnabled
48
51
  };
49
52
 
50
53
  if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {
51
54
  out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;
52
- out.rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;
53
55
  } else {
54
56
  out.teacherInstructions = null;
55
- out.rationale = null;
56
57
  }
57
58
 
58
59
  resolve(out);
@@ -68,9 +69,9 @@ var createDefaultModel = function createDefaultModel() {
68
69
 
69
70
  exports.createDefaultModel = createDefaultModel;
70
71
 
71
- function outcome()
72
- /*config, session*/
73
- {
72
+ function
73
+ /*config, session*/
74
+ outcome() {
74
75
  return new Promise(function (resolve) {
75
76
  log('outcome...');
76
77
  resolve({
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["log","normalize","question","rationaleEnabled","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","model","session","env","normalizedQuestion","imageUrl","imageDimensions","prompt","Promise","resolve","out","disabled","mode","role","teacherInstructions","rationale","createDefaultModel","defaults","outcome","score","completed","note"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,0CAAN,CAAZ;;AAEO,IAAMC,SAAS,GAAG,SAAZA,SAAY,CAAAC,QAAQ;AAAA;AAC/BC,IAAAA,gBAAgB,EAAE,IADa;AAE/BC,IAAAA,aAAa,EAAE,IAFgB;AAG/BC,IAAAA,0BAA0B,EAAE,IAHG;AAI/BC,IAAAA,0BAA0B,EAAE;AAJG,KAK5BJ,QAL4B;AAAA,CAA1B;;;;AAQA,SAASK,KAAT,CAAeL,QAAf,EAAyBM,OAAzB,EAAkCC,GAAlC,EAAuC;AAC5C,MAAMC,kBAAkB,GAAGT,SAAS,CAACC,QAAD,CAApC;AAD4C,MAG1CS,QAH0C,GAOxCD,kBAPwC,CAG1CC,QAH0C;AAAA,MAI1CC,eAJ0C,GAOxCF,kBAPwC,CAI1CE,eAJ0C;AAAA,MAK1CC,MAL0C,GAOxCH,kBAPwC,CAK1CG,MAL0C;AAAA,MAM1CT,aAN0C,GAOxCM,kBAPwC,CAM1CN,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;AACNU,MAAAA,KAAK,EAAE,CADD;AAENC,MAAAA,SAAS,EAAE,KAFL;AAGNC,MAAAA,IAAI,EAAE;AAHA,KAAD,CAAP;AAKD,GAPM,CAAP;AAQD","sourcesContent":["import debug from 'debug';\nimport defaults from './defaults';\n\nconst log = debug('pie-elements:drawing-response:controller');\n\nexport const normalize = question => ({\n rationaleEnabled: true,\n promptEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n ...question,\n});\n\nexport function model(question, session, env) {\n const normalizedQuestion = normalize(question);\n const {\n imageUrl,\n imageDimensions,\n prompt,\n promptEnabled\n } = normalizedQuestion;\n\n return new Promise(resolve => {\n const out = {\n disabled: env.mode !== 'gather',\n mode: env.mode,\n imageDimensions,\n imageUrl,\n prompt: promptEnabled ? prompt : null,\n };\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;\n out.rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;\n } else {\n out.teacherInstructions = null;\n out.rationale = null;\n }\n\n resolve(out);\n });\n}\n\nexport const createDefaultModel = (model = {}) =>\n new Promise(resolve => {\n resolve({\n ...defaults,\n ...model,\n })\n });\n\nexport function outcome(/*config, session*/) {\n return new Promise(resolve => {\n log('outcome...');\n resolve({\n score: 0,\n completed: 'n/a',\n note: 'Requires manual scoring'\n });\n });\n}\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.js"],"names":["log","normalize","question","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","backgroundImageEnabled","model","session","env","normalizedQuestion","imageUrl","imageDimensions","prompt","Promise","resolve","out","disabled","mode","role","teacherInstructions","createDefaultModel","defaults","outcome","score","completed","note"],"mappings":";;;;;;;;;;;;;;AAAA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,0CAAN,CAAZ;;AAEO,IAAMC,SAAS,GAAG,S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BAAJ,GAA0B,IAA1B;AACD;;AAEDL,IAAAA,OAAO,CAACC,GAAD,CAAP;AACD,GAnBM,CAAP;AAoBD;;AAEM,IAAMK,kBAAkB,GAAG,SAArBA,kBAAqB;AAAA,MAACd,KAAD,uEAAS,EAAT;AAAA,SAChC,IAAIO,OAAJ,CAAY,UAACC,OAAD,EAAa;AACvBA,IAAAA,OAAO,iCACFO,oBADE,GAEFf,KAFE,EAAP;AAID,GALD,CADgC;AAAA,CAA3B;;;;AAQA;AAAiB;AAARgB,OAAT,GAAsC;AAC3C,SAAO,IAAIT,OAAJ,CAAY,UAACC,OAAD,EAAa;AAC9Bf,IAAAA,GAAG,CAAC,YAAD,CAAH;AACAe,IAAAA,OAAO,CAAC;AACNS,MAAAA,KAAK,EAAE,CADD;AAENC,MAAAA,SAAS,EAAE,KAFL;AAGNC,MAAAA,IAAI,EAAE;AAHA,KAAD,CAAP;AAKD,GAPM,CAAP;AAQD","sourcesContent":["import debug from 'debug';\nimport defaults from './defaults';\n\nconst log = debug('pie-elements:drawing-response:controller');\n\nexport const normalize = (question) => ({\n promptEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n backgroundImageEnabled: true,\n ...question,\n});\n\nexport function model(question, session, env) {\n const normalizedQuestion = normalize(question);\n const { imageUrl, imageDimensions, prompt, promptEnabled, backgroundImageEnabled } = normalizedQuestion;\n\n return new Promise((resolve) => {\n const out = {\n disabled: env.mode !== 'gather',\n mode: env.mode,\n imageDimensions,\n imageUrl,\n prompt: promptEnabled ? prompt : null,\n backgroundImageEnabled,\n };\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n } else {\n out.teacherInstructions = null;\n }\n\n resolve(out);\n });\n}\n\nexport const createDefaultModel = (model = {}) =>\n new Promise((resolve) => {\n resolve({\n ...defaults,\n ...model,\n });\n });\n\nexport function outcome(/*config, session*/) {\n return new Promise((resolve) => {\n log('outcome...');\n resolve({\n score: 0,\n completed: 'n/a',\n note: 'Requires manual scoring',\n });\n });\n}\n"],"file":"index.js"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pie-element/drawing-response-controller",
3
3
  "private": true,
4
- "version": "3.1.8",
4
+ "version": "3.2.9",
5
5
  "description": "",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -10,10 +10,10 @@ describe('controller', () => {
10
10
  imageUrl: '',
11
11
  imageDimensions: {
12
12
  height: 0,
13
- width: 0
13
+ width: 0,
14
14
  },
15
- rationale: 'Rationale',
16
- teacherInstructions: 'Teacher Instructions'
15
+ teacherInstructions: 'Teacher Instructions',
16
+ backgroundImageEnabled: true,
17
17
  };
18
18
  });
19
19
 
@@ -49,7 +49,7 @@ describe('controller', () => {
49
49
  });
50
50
 
51
51
  it('gather mode promptEnabled: true', async () => {
52
- result = await model(question, {}, { mode: 'gather'});
52
+ result = await model(question, {}, { mode: 'gather' });
53
53
 
54
54
  expect(result).toEqual({
55
55
  disabled: false,
@@ -57,13 +57,13 @@ describe('controller', () => {
57
57
  imageUrl: question.imageUrl,
58
58
  imageDimensions: question.imageDimensions,
59
59
  prompt: question.prompt,
60
- rationale: null,
61
- teacherInstructions: null
60
+ teacherInstructions: null,
61
+ backgroundImageEnabled: question.backgroundImageEnabled,
62
62
  });
63
63
  });
64
64
 
65
65
  it('gather mode promptEnabled: false', async () => {
66
- result = await model({ ...question, promptEnabled: false }, {}, { mode: 'gather'});
66
+ result = await model({ ...question, promptEnabled: false }, {}, { mode: 'gather' });
67
67
 
68
68
  expect(result).toEqual({
69
69
  disabled: false,
@@ -71,14 +71,13 @@ describe('controller', () => {
71
71
  imageUrl: question.imageUrl,
72
72
  imageDimensions: question.imageDimensions,
73
73
  prompt: null,
74
- rationale: null,
75
- teacherInstructions: null
74
+ teacherInstructions: null,
75
+ backgroundImageEnabled: question.backgroundImageEnabled,
76
76
  });
77
77
  });
78
78
 
79
-
80
79
  it('view mode, student role', async () => {
81
- result = await model(question, {}, { mode: 'view'});
80
+ result = await model(question, {}, { mode: 'view' });
82
81
 
83
82
  expect(result).toEqual({
84
83
  disabled: true,
@@ -86,13 +85,13 @@ describe('controller', () => {
86
85
  imageUrl: question.imageUrl,
87
86
  imageDimensions: question.imageDimensions,
88
87
  prompt: question.prompt,
89
- rationale: null,
90
- teacherInstructions: null
88
+ teacherInstructions: null,
89
+ backgroundImageEnabled: question.backgroundImageEnabled,
91
90
  });
92
91
  });
93
92
 
94
- it('view mode, instructor role, rationale and teacherInstructions enabled', async () => {
95
- result = await model(question, {}, { mode: 'view', role: 'instructor'});
93
+ it('view mode, instructor role and teacherInstructions enabled', async () => {
94
+ result = await model(question, {}, { mode: 'view', role: 'instructor' });
96
95
 
97
96
  expect(result).toEqual({
98
97
  disabled: true,
@@ -100,16 +99,17 @@ describe('controller', () => {
100
99
  imageUrl: question.imageUrl,
101
100
  imageDimensions: question.imageDimensions,
102
101
  prompt: question.prompt,
103
- rationale: question.rationale,
104
- teacherInstructions: question.teacherInstructions
102
+ teacherInstructions: question.teacherInstructions,
103
+ backgroundImageEnabled: question.backgroundImageEnabled,
105
104
  });
106
105
  });
107
106
 
108
- it('evaluate mode, instructor role, rationale and teacherInstructions disabled', async () => {
107
+ it('evaluate mode, instructor role and teacherInstructions disabled', async () => {
109
108
  result = await model(
110
- { ...question, rationaleEnabled: false, teacherInstructionsEnabled: false },
109
+ { ...question, teacherInstructionsEnabled: false },
111
110
  {},
112
- { mode: 'evaluate', role: 'instructor'});
111
+ { mode: 'evaluate', role: 'instructor' },
112
+ );
113
113
 
114
114
  expect(result).toEqual({
115
115
  disabled: true,
@@ -117,13 +117,13 @@ describe('controller', () => {
117
117
  imageUrl: question.imageUrl,
118
118
  imageDimensions: question.imageDimensions,
119
119
  prompt: question.prompt,
120
- rationale: null,
121
- teacherInstructions: null
120
+ teacherInstructions: null,
121
+ backgroundImageEnabled: question.backgroundImageEnabled,
122
122
  });
123
123
  });
124
124
 
125
125
  it('evaluate mode, student role', async () => {
126
- result = await model(question, {}, { mode: 'evaluate'});
126
+ result = await model(question, {}, { mode: 'evaluate' });
127
127
 
128
128
  expect(result).toEqual({
129
129
  disabled: true,
@@ -131,13 +131,13 @@ describe('controller', () => {
131
131
  imageUrl: question.imageUrl,
132
132
  imageDimensions: question.imageDimensions,
133
133
  prompt: question.prompt,
134
- rationale: null,
135
- teacherInstructions: null
134
+ teacherInstructions: null,
135
+ backgroundImageEnabled: question.backgroundImageEnabled,
136
136
  });
137
137
  });
138
138
 
139
- it('evaluate mode, instructor role, rationale and teacherInstructions enabled', async () => {
140
- result = await model(question, {}, { mode: 'evaluate', role: 'instructor'});
139
+ it('evaluate mode, instructor role and teacherInstructions enabled', async () => {
140
+ result = await model(question, {}, { mode: 'evaluate', role: 'instructor' });
141
141
 
142
142
  expect(result).toEqual({
143
143
  disabled: true,
@@ -145,16 +145,17 @@ describe('controller', () => {
145
145
  imageUrl: question.imageUrl,
146
146
  imageDimensions: question.imageDimensions,
147
147
  prompt: question.prompt,
148
- rationale: question.rationale,
149
- teacherInstructions: question.teacherInstructions
148
+ teacherInstructions: question.teacherInstructions,
149
+ backgroundImageEnabled: question.backgroundImageEnabled,
150
150
  });
151
151
  });
152
152
 
153
- it('view mode, instructor role, rationale and teacherInstructions disabled', async () => {
153
+ it('view mode, instructor role and teacherInstructions disabled', async () => {
154
154
  result = await model(
155
- { ...question, rationaleEnabled: false, teacherInstructionsEnabled: false },
155
+ { ...question, teacherInstructionsEnabled: false },
156
156
  {},
157
- { mode: 'view', role: 'instructor'});
157
+ { mode: 'view', role: 'instructor' },
158
+ );
158
159
 
159
160
  expect(result).toEqual({
160
161
  disabled: true,
@@ -162,8 +163,8 @@ describe('controller', () => {
162
163
  imageUrl: question.imageUrl,
163
164
  imageDimensions: question.imageDimensions,
164
165
  prompt: question.prompt,
165
- rationale: null,
166
- teacherInstructions: null
166
+ teacherInstructions: null,
167
+ backgroundImageEnabled: question.backgroundImageEnabled,
167
168
  });
168
169
  });
169
170
  });
@@ -3,6 +3,6 @@ export default {
3
3
  imageUrl: '',
4
4
  imageDimensions: {
5
5
  height: 0,
6
- width: 0
7
- }
6
+ width: 0,
7
+ },
8
8
  };
@@ -3,38 +3,34 @@ import defaults from './defaults';
3
3
 
4
4
  const log = debug('pie-elements:drawing-response:controller');
5
5
 
6
- export const normalize = question => ({
7
- rationaleEnabled: true,
6
+ export const normalize = (question) => ({
8
7
  promptEnabled: true,
9
8
  teacherInstructionsEnabled: true,
10
9
  studentInstructionsEnabled: true,
10
+ backgroundImageEnabled: true,
11
11
  ...question,
12
12
  });
13
13
 
14
14
  export function model(question, session, env) {
15
15
  const normalizedQuestion = normalize(question);
16
- const {
17
- imageUrl,
18
- imageDimensions,
19
- prompt,
20
- promptEnabled
21
- } = normalizedQuestion;
22
-
23
- return new Promise(resolve => {
16
+ const { imageUrl, imageDimensions, prompt, promptEnabled, backgroundImageEnabled } = normalizedQuestion;
17
+
18
+ return new Promise((resolve) => {
24
19
  const out = {
25
20
  disabled: env.mode !== 'gather',
26
21
  mode: env.mode,
27
22
  imageDimensions,
28
23
  imageUrl,
29
24
  prompt: promptEnabled ? prompt : null,
25
+ backgroundImageEnabled,
30
26
  };
31
27
 
32
28
  if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {
33
- out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;
34
- out.rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;
29
+ out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled
30
+ ? normalizedQuestion.teacherInstructions
31
+ : null;
35
32
  } else {
36
33
  out.teacherInstructions = null;
37
- out.rationale = null;
38
34
  }
39
35
 
40
36
  resolve(out);
@@ -42,20 +38,20 @@ export function model(question, session, env) {
42
38
  }
43
39
 
44
40
  export const createDefaultModel = (model = {}) =>
45
- new Promise(resolve => {
41
+ new Promise((resolve) => {
46
42
  resolve({
47
43
  ...defaults,
48
44
  ...model,
49
- })
45
+ });
50
46
  });
51
47
 
52
48
  export function outcome(/*config, session*/) {
53
- return new Promise(resolve => {
49
+ return new Promise((resolve) => {
54
50
  log('outcome...');
55
51
  resolve({
56
52
  score: 0,
57
53
  completed: 'n/a',
58
- note: 'Requires manual scoring'
54
+ note: 'Requires manual scoring',
59
55
  });
60
56
  });
61
57
  }
@@ -40,7 +40,12 @@
40
40
  }
41
41
  }
42
42
  },
43
- "rationale": {
43
+ "settingsPanelDisabled": {
44
+ "description": "Indicates if the settings panel is not available",
45
+ "type": "boolean",
46
+ "title": "settingsPanelDisabled"
47
+ },
48
+ "spellCheck": {
44
49
  "title": "ConfigureProp",
45
50
  "type": "object",
46
51
  "properties": {
@@ -88,6 +93,69 @@
88
93
  }
89
94
  }
90
95
  },
96
+ "maxImageWidth": {
97
+ "title": "ConfigureMaxImageDimensionsProp",
98
+ "type": "object",
99
+ "properties": {
100
+ "teacherInstructions": {
101
+ "description": "Indicates the max dimension for images in teacher instructions",
102
+ "type": "number",
103
+ "title": "teacherInstructions"
104
+ },
105
+ "prompt": {
106
+ "description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
107
+ "type": "number",
108
+ "title": "prompt"
109
+ },
110
+ "rationale": {
111
+ "description": "Indicates the max dimension for images in rationale",
112
+ "type": "number",
113
+ "title": "rationale"
114
+ }
115
+ }
116
+ },
117
+ "maxImageHeight": {
118
+ "title": "ConfigureMaxImageDimensionsProp",
119
+ "type": "object",
120
+ "properties": {
121
+ "teacherInstructions": {
122
+ "description": "Indicates the max dimension for images in teacher instructions",
123
+ "type": "number",
124
+ "title": "teacherInstructions"
125
+ },
126
+ "prompt": {
127
+ "description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
128
+ "type": "number",
129
+ "title": "prompt"
130
+ },
131
+ "rationale": {
132
+ "description": "Indicates the max dimension for images in rationale",
133
+ "type": "number",
134
+ "title": "rationale"
135
+ }
136
+ }
137
+ },
138
+ "withRubric": {
139
+ "title": "ConfigureWithForceProp",
140
+ "type": "object",
141
+ "properties": {
142
+ "settings": {
143
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
144
+ "type": "boolean",
145
+ "title": "settings"
146
+ },
147
+ "label": {
148
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
149
+ "type": "string",
150
+ "title": "label"
151
+ },
152
+ "forceEnabled": {
153
+ "description": "Indicates the value for the toggle; if true, this property will not be visible in Settings Panel",
154
+ "type": "boolean",
155
+ "title": "forceEnabled"
156
+ }
157
+ }
158
+ },
91
159
  "showPrompt": {
92
160
  "description": "Determines whether prompt field will be displayed or not",
93
161
  "default": true,
@@ -138,6 +206,48 @@
138
206
  "title": "label"
139
207
  }
140
208
  }
209
+ },
210
+ "ConfigureMaxImageDimensionsProp": {
211
+ "title": "ConfigureMaxImageDimensionsProp",
212
+ "type": "object",
213
+ "properties": {
214
+ "teacherInstructions": {
215
+ "description": "Indicates the max dimension for images in teacher instructions",
216
+ "type": "number",
217
+ "title": "teacherInstructions"
218
+ },
219
+ "prompt": {
220
+ "description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
221
+ "type": "number",
222
+ "title": "prompt"
223
+ },
224
+ "rationale": {
225
+ "description": "Indicates the max dimension for images in rationale",
226
+ "type": "number",
227
+ "title": "rationale"
228
+ }
229
+ }
230
+ },
231
+ "ConfigureWithForceProp": {
232
+ "title": "ConfigureWithForceProp",
233
+ "type": "object",
234
+ "properties": {
235
+ "settings": {
236
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
237
+ "type": "boolean",
238
+ "title": "settings"
239
+ },
240
+ "label": {
241
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
242
+ "type": "string",
243
+ "title": "label"
244
+ },
245
+ "forceEnabled": {
246
+ "description": "Indicates the value for the toggle; if true, this property will not be visible in Settings Panel",
247
+ "type": "boolean",
248
+ "title": "forceEnabled"
249
+ }
250
+ }
141
251
  }
142
252
  },
143
253
  "$schema": "http://json-schema.org/draft-07/schema#"
@@ -31,9 +31,13 @@ Indicates if the item has to be displayed in the Settings Panel
31
31
 
32
32
  Indicates the label for the item that has to be displayed in the Settings Panel
33
33
 
34
- # `rationale` (object)
34
+ # `settingsPanelDisabled` (boolean)
35
35
 
36
- Properties of the `rationale` object:
36
+ Indicates if the settings panel is not available
37
+
38
+ # `spellCheck` (object)
39
+
40
+ Properties of the `spellCheck` object:
37
41
 
38
42
  ## `settings` (boolean)
39
43
 
@@ -67,6 +71,54 @@ Indicates if the item has to be displayed in the Settings Panel
67
71
 
68
72
  Indicates the label for the item that has to be displayed in the Settings Panel
69
73
 
74
+ # `maxImageWidth` (object)
75
+
76
+ Properties of the `maxImageWidth` object:
77
+
78
+ ## `teacherInstructions` (number)
79
+
80
+ Indicates the max dimension for images in teacher instructions
81
+
82
+ ## `prompt` (number)
83
+
84
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
85
+
86
+ ## `rationale` (number)
87
+
88
+ Indicates the max dimension for images in rationale
89
+
90
+ # `maxImageHeight` (object)
91
+
92
+ Properties of the `maxImageHeight` object:
93
+
94
+ ## `teacherInstructions` (number)
95
+
96
+ Indicates the max dimension for images in teacher instructions
97
+
98
+ ## `prompt` (number)
99
+
100
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
101
+
102
+ ## `rationale` (number)
103
+
104
+ Indicates the max dimension for images in rationale
105
+
106
+ # `withRubric` (object)
107
+
108
+ Properties of the `withRubric` object:
109
+
110
+ ## `settings` (boolean)
111
+
112
+ Indicates if the item has to be displayed in the Settings Panel
113
+
114
+ ## `label` (string)
115
+
116
+ Indicates the label for the item that has to be displayed in the Settings Panel
117
+
118
+ ## `forceEnabled` (boolean)
119
+
120
+ Indicates the value for the toggle; if true, this property will not be visible in Settings Panel
121
+
70
122
  # `showPrompt` (boolean)
71
123
 
72
124
  Determines whether prompt field will be displayed or not
@@ -112,4 +164,36 @@ Indicates if the item has to be displayed in the Settings Panel
112
164
 
113
165
  ### `label` (string)
114
166
 
115
- Indicates the label for the item that has to be displayed in the Settings Panel
167
+ Indicates the label for the item that has to be displayed in the Settings Panel
168
+
169
+ ## `ConfigureMaxImageDimensionsProp` (object)
170
+
171
+ Properties of the `ConfigureMaxImageDimensionsProp` object:
172
+
173
+ ### `teacherInstructions` (number)
174
+
175
+ Indicates the max dimension for images in teacher instructions
176
+
177
+ ### `prompt` (number)
178
+
179
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
180
+
181
+ ### `rationale` (number)
182
+
183
+ Indicates the max dimension for images in rationale
184
+
185
+ ## `ConfigureWithForceProp` (object)
186
+
187
+ Properties of the `ConfigureWithForceProp` object:
188
+
189
+ ### `settings` (boolean)
190
+
191
+ Indicates if the item has to be displayed in the Settings Panel
192
+
193
+ ### `label` (string)
194
+
195
+ Indicates the label for the item that has to be displayed in the Settings Panel
196
+
197
+ ### `forceEnabled` (boolean)
198
+
199
+ Indicates the value for the toggle; if true, this property will not be visible in Settings Panel
@@ -2,7 +2,7 @@ const { model } = require('./generate');
2
2
 
3
3
  module.exports = {
4
4
  elements: {
5
- 'drawing-response': '../..'
5
+ 'drawing-response': '../..',
6
6
  },
7
- models: [model('1', 'drawing-response')]
7
+ models: [model('1', 'drawing-response')],
8
8
  };
@@ -3,9 +3,12 @@ exports.model = (id, element) => ({
3
3
  element,
4
4
  prompt: 'This is the question prompt',
5
5
  promptEnabled: true,
6
+ backgroundImageEnabled: true,
7
+ toolbarEditorPosition: 'bottom',
6
8
  imageUrl: '',
7
9
  imageDimensions: {
8
10
  height: 0,
9
- width: 0
10
- }
11
+ width: 0,
12
+ },
13
+ rubricEnabled: false,
11
14
  });
@@ -30,8 +30,8 @@ module.exports = [
30
30
  createdAt: '2020-01-21T11:03:51.257Z',
31
31
  fontSize: 16,
32
32
  textareaVisible: false,
33
- transformerVisible: false
34
- }
35
- ]
36
- }
33
+ transformerVisible: false,
34
+ },
35
+ ],
36
+ },
37
37
  ];