@windward/core 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/components/Content/Blocks/Accordion.vue +10 -2
  2. package/components/Content/Blocks/BlockQuote.vue +6 -2
  3. package/components/Content/Blocks/ClickableIcons.vue +10 -2
  4. package/components/Content/Blocks/Email.vue +7 -7
  5. package/components/Content/Blocks/HorizontalRule.vue +2 -0
  6. package/components/Content/Blocks/OpenResponse.vue +25 -0
  7. package/components/Content/Blocks/OpenResponseCollate.vue +13 -12
  8. package/components/Content/Blocks/ScenarioChoice.vue +10 -2
  9. package/components/Content/Blocks/Tab.vue +17 -3
  10. package/components/Content/Blocks/UserUpload.vue +5 -3
  11. package/components/Content/Blocks/Video.vue +33 -7
  12. package/components/Settings/AccordionSettings.vue +20 -34
  13. package/components/Settings/BlockQuoteSettings.vue +17 -41
  14. package/components/Settings/ClickableIconsSettings.vue +18 -40
  15. package/components/Settings/EmailSettings.vue +12 -38
  16. package/components/Settings/FileDownloadSettings.vue +10 -35
  17. package/components/Settings/ImageSettings.vue +3 -9
  18. package/components/Settings/OpenResponseCollateSettings.vue +47 -55
  19. package/components/Settings/OpenResponseSettings.vue +62 -36
  20. package/components/Settings/ScenarioChoiceSettings.vue +13 -35
  21. package/components/Settings/TabSettings.vue +8 -33
  22. package/components/Settings/UserUploadSettings.vue +6 -30
  23. package/components/Settings/VideoSettings/SourcePicker.vue +1 -0
  24. package/components/Settings/VideoSettings.vue +6 -42
  25. package/components/utils/TinyMCEWrapper.vue +6 -3
  26. package/helpers/GlossaryHelper.ts +12 -2
  27. package/i18n/en-US/components/settings/open_response_collate.ts +1 -1
  28. package/i18n/en-US/components/settings/scenario_choice.ts +3 -2
  29. package/i18n/en-US/components/settings/video.ts +1 -1
  30. package/i18n/en-US/shared/settings.ts +1 -1
  31. package/i18n/es-ES/components/settings/open_response_collate.ts +1 -1
  32. package/i18n/es-ES/components/settings/scenario_choice.ts +3 -2
  33. package/i18n/es-ES/components/settings/video.ts +1 -1
  34. package/i18n/es-ES/shared/settings.ts +1 -1
  35. package/i18n/sv-SE/components/settings/open_response_collate.ts +1 -1
  36. package/i18n/sv-SE/components/settings/scenario_choice.ts +3 -2
  37. package/i18n/sv-SE/components/settings/video.ts +1 -1
  38. package/package.json +2 -2
  39. package/test/__mocks__/modelMock.js +1 -1
  40. package/test/helpers/GlossaryHelper.spec.js +22 -3
  41. package/test/mocks.js +8 -0
@@ -1,18 +1,20 @@
1
1
  <template>
2
2
  <div>
3
3
  <v-text-field
4
+ id="block-settings-title"
4
5
  v-model="block.metadata.config.title"
5
6
  outlined
6
- :rules="validation.titleRules"
7
- :counter="50"
7
+ :rules="$Validation.getRule('block.title')"
8
+ :counter="$Validation.getLimit('block.title')"
8
9
  :autofocus="true"
9
10
  :label="$t('components.content.settings.base.title')"
10
11
  :disabled="render"
11
12
  ></v-text-field>
12
13
  <v-textarea
14
+ id="block-settings-instructions"
13
15
  v-model="block.metadata.config.instructions"
14
- :rules="validation.instructionRule"
15
- :counter="255"
16
+ :rules="$Validation.getRule('block.instructions')"
17
+ :counter="$Validation.getLimit('block.instructions')"
16
18
  outlined
17
19
  :label="$t('components.content.settings.base.instructions')"
18
20
  :disabled="render"
@@ -129,32 +131,6 @@ export default {
129
131
  boilerplate: true,
130
132
  elevation: 0,
131
133
  },
132
- validation: {
133
- titleRules: [
134
- (v) => {
135
- if (v && v.length >= 50) {
136
- return this.$t(
137
- 'windward.core.shared.settings.errors.input_limitations',
138
- [50]
139
- )
140
- } else {
141
- return true
142
- }
143
- },
144
- ],
145
- instructionRule: [
146
- (v) => {
147
- if (v && v.length >= 255) {
148
- return this.$t(
149
- 'windward.core.shared.settings.errors.input_limitations',
150
- [255]
151
- )
152
- } else {
153
- return true
154
- }
155
- },
156
- ],
157
- },
158
134
  }
159
135
  },
160
136
  mounted() {},
@@ -84,6 +84,7 @@
84
84
  :assets="assets"
85
85
  mimes="text/vtt,text/xml"
86
86
  allow-url
87
+ outlined
87
88
  class="mb-4"
88
89
  :disabled="disabled || sourceInherit || !source"
89
90
  @input="$emit('update:track', $event)"
@@ -3,19 +3,21 @@
3
3
  <v-row>
4
4
  <v-col cols="12">
5
5
  <v-text-field
6
+ id="block-settings-title"
6
7
  v-model="block.metadata.config.title"
7
- :counter="50"
8
+ :rules="$Validation.getRule('block.title')"
9
+ :counter="$Validation.getLimit('block.title')"
8
10
  outlined
9
- :rules="validation.shortInputRules"
10
11
  :label="$t('windward.core.components.settings.video.title')"
11
12
  :disabled="render"
12
13
  ></v-text-field>
13
14
  <v-textarea
15
+ id="block-settings-instructions"
14
16
  v-model="block.metadata.config.description"
15
17
  outlined
16
18
  auto-grow
17
- :rules="validation.instructionRule"
18
- :counter="255"
19
+ :rules="$Validation.getRule('block.instructions')"
20
+ :counter="$Validation.getLimit('block.instructions')"
19
21
  :label="
20
22
  $t(
21
23
  'components.content.settings.base.description_optional'
@@ -426,44 +428,6 @@ export default {
426
428
  },
427
429
  },
428
430
  },
429
- validation: {
430
- shortInputRules: [
431
- (v) => {
432
- if (v && v.length >= 50) {
433
- return this.$t(
434
- 'windward.core.shared.settings.errors.input_limitations',
435
- [50]
436
- )
437
- } else {
438
- return true
439
- }
440
- },
441
- ],
442
- instructionRule: [
443
- (v) => {
444
- if (v && v.length >= 255) {
445
- return this.$t(
446
- 'windward.core.shared.settings.errors.input_limitations',
447
- [255]
448
- )
449
- } else {
450
- return true
451
- }
452
- },
453
- ],
454
- clueRule: [
455
- (v) => {
456
- if (v && v.length >= 155) {
457
- return this.$t(
458
- 'windward.core.shared.settings.errors.input_limitations',
459
- [155]
460
- )
461
- } else {
462
- return true
463
- }
464
- },
465
- ],
466
- },
467
431
  showPreRoll: false,
468
432
  showPostRoll: false,
469
433
  }
@@ -7,8 +7,9 @@
7
7
  "
8
8
  :data-cy="dataCy"
9
9
  >
10
- <label v-if="label" class="editor-label">{{ label }}</label>
11
-
10
+ <slot name="label" :render="render">
11
+ <label v-if="label" class="editor-label">{{ label }}</label>
12
+ </slot>
12
13
  <Editor
13
14
  :id="id"
14
15
  :key="seed + (isDarkTheme ? '-theme-dark' : '-theme-light')"
@@ -26,7 +27,9 @@
26
27
  >
27
28
  </Editor>
28
29
 
29
- <label v-if="hint" class="editor-hint">{{ hint }}</label>
30
+ <slot name="hint" :render="render">
31
+ <label v-if="hint" class="editor-hint">{{ hint }}</label>
32
+ </slot>
30
33
  </div>
31
34
 
32
35
  <v-btn-toggle dense multiple class="pt-1 d-flex justify-end">
@@ -62,9 +62,14 @@ export default class GlossaryHelper {
62
62
  addTerm = false
63
63
  }
64
64
  })
65
+
65
66
  if (
66
- _.trim(_.toLower(match[1])) ===
67
- _.trim(_.toLower(term.term)) &&
67
+ ( _.trim(_.toLower(match[1])) ===
68
+ _.trim(_.toLower(term.term)) ||
69
+ term.alternate_forms && _.some(term.alternate_forms, alt => _.trim(_.toLower(alt)) === _.trim(_.toLower(match[1])))
70
+
71
+ )
72
+ &&
68
73
  addTerm
69
74
  ) {
70
75
  verifiedTerms.push(new GlossaryTerm(term))
@@ -98,6 +103,8 @@ export default class GlossaryHelper {
98
103
  inGlossary = glossary.filter((item: any) => {
99
104
  if (
100
105
  _.trim(_.toLower(item.term)) === _.trim(_.toLower(match[1]))
106
+ ||
107
+ item.alternate_forms && _.some(item.alternate_forms, alt => _.trim(_.toLower(alt)) === _.trim(_.toLower(match[1])))
101
108
  ) {
102
109
  return item
103
110
  }
@@ -140,6 +147,9 @@ export default class GlossaryHelper {
140
147
  currentGlossary.forEach((term: any) => {
141
148
  if (
142
149
  _.trim(_.toLower(match[1])) === _.trim(_.toLower(term.term))
150
+ ||
151
+ ( term.alternate_forms &&
152
+ _.some(term.alternate_forms, alt => _.trim(_.toLower(alt)) === _.trim(_.toLower(match[1]))))
143
153
  ) {
144
154
  content = content.replace(
145
155
  match[0],
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  instructions:
3
- 'Check off open responses to collate. Drag the prompts to set the order you want the responses collated',
3
+ 'Check off open response items to collate into a document.',
4
4
  include_prompts: 'Include Prompts',
5
5
  filename: 'Filename (Blank for current page name)',
6
6
  }
@@ -3,8 +3,8 @@ export default {
3
3
  description: 'Description',
4
4
  over_item_limit: 'Cannot add more items',
5
5
  no_title: 'No Title',
6
- item_title: 'Item Title',
7
- item_text: 'Item Text',
6
+ item_title: 'Choice Text',
7
+ item_text: 'Explanation of This Choice',
8
8
  correct_choice: 'Is Correct Choice',
9
9
  show_reset: 'Allow Retries',
10
10
  display_style: 'Display Style',
@@ -16,4 +16,5 @@ export default {
16
16
  letter: 'Letters',
17
17
  number: 'Numbers',
18
18
  },
19
+ add_choice: 'Add Choice',
19
20
  }
@@ -42,7 +42,7 @@ export default {
42
42
  postroll: 'Postroll',
43
43
  },
44
44
  caption: {
45
- title: 'Captions File',
45
+ title: 'Place Local Captions File',
46
46
  configure_blurb:
47
47
  'Upload a captions file (.vtt or .xml), pick one from the file manager, or add via the public URL',
48
48
  },
@@ -21,7 +21,7 @@ export default {
21
21
  block_quote: 'Block Quote Settings',
22
22
  },
23
23
  errors: {
24
- input_limitations: 'Must be less than {0} characters.'
24
+ input_limitations: 'Must be less than {0} characters.',
25
25
  },
26
26
  upload_file: 'Upload File',
27
27
  alt_image: 'Alternate text for image',
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  instructions:
3
- 'Marque las respuestas abiertas para cotejar. Arrastra las indicaciones para establecer el orden en el que deseas que se cotejen las respuestas',
3
+ 'Marque los elementos de respuesta abiertos para recopilarlos en un documento.',
4
4
  include_prompts: 'Incluir mensajes',
5
5
  filename:
6
6
  'Nombre de archivo (en blanco para el nombre de la página actual)',
@@ -3,8 +3,8 @@ export default {
3
3
  description: 'Descripción',
4
4
  over_item_limit: 'No se pueden agregar más elementos',
5
5
  no_title: 'Sin título',
6
- item_title: 'Título del artículo',
7
- item_text: 'Texto del elemento',
6
+ item_title: 'Texto de elección',
7
+ item_text: 'Explicación de esta elección',
8
8
  correct_choice: 'Es la elección correcta',
9
9
  show_reset: 'Permitir reintentos',
10
10
  display_style: 'Estilo de visualización',
@@ -16,4 +16,5 @@ export default {
16
16
  letter: 'Letras',
17
17
  number: 'Números',
18
18
  },
19
+ add_choice: 'Agregar opción',
19
20
  }
@@ -44,7 +44,7 @@ export default {
44
44
  postroll: 'Desplazamiento posterior',
45
45
  },
46
46
  caption: {
47
- title: 'Archivo de subtítulos',
47
+ title: 'Colocar archivo de subtítulos locales',
48
48
  configure_blurb:
49
49
  'Cargue un archivo de subtítulos (.vtt o .xml), elija uno del administrador de archivos o agréguelo a través de la URL pública',
50
50
  },
@@ -23,7 +23,7 @@ export default {
23
23
  block_quote: 'Configuración de cotización en bloque',
24
24
  },
25
25
  errors: {
26
- input_limitations: 'Debe tener menos de {0} caracteres.'
26
+ input_limitations: 'Debe tener menos de {0} caracteres.',
27
27
  },
28
28
  upload_file: 'Subir Archivo',
29
29
  alt_image: 'Texto alternativo para imagen',
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  instructions:
3
- 'Bocka av öppna svar för att sortera. Dra uppmaningarna för att ställa in den ordning du vill att svaren ska sorteras',
3
+ 'Bocka av öppna svarsobjekt för att sortera till ett dokument.',
4
4
  include_prompts: 'Inkludera uppmaningar',
5
5
  filename: 'Filnamn (tomt för nuvarande sidnamn)',
6
6
  }
@@ -3,8 +3,8 @@ export default {
3
3
  description: 'Beskrivning',
4
4
  over_item_limit: 'Kan inte lägga till fler objekt',
5
5
  no_title: 'Ingen titel',
6
- item_title: 'Artikeltitel',
7
- item_text: 'Artikeltext',
6
+ item_title: 'Valtext',
7
+ item_text: 'Förklaring av detta val',
8
8
  correct_choice: 'Är rätt val',
9
9
  show_reset: 'Tillåt återförsök',
10
10
  display_style: 'Visa stil',
@@ -16,4 +16,5 @@ export default {
16
16
  letter: 'Brev',
17
17
  number: 'Nummer',
18
18
  },
19
+ add_choice: 'Lägg till val',
19
20
  }
@@ -42,7 +42,7 @@ export default {
42
42
  postroll: 'Postroll',
43
43
  },
44
44
  caption: {
45
- title: 'Captions File',
45
+ title: 'Placera en lokal bildtextfil',
46
46
  configure_blurb:
47
47
  'Ladda upp en bildtextfil (.vtt eller .xml), välj en från filhanteraren eller lägg till via den offentliga webbadressen',
48
48
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windward/core",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Windward UI Core Plugins",
5
5
  "main": "plugin.js",
6
6
  "scripts": {
@@ -36,6 +36,7 @@
36
36
  },
37
37
  "devDependencies": {
38
38
  "@babel/preset-env": "^7.16.11",
39
+ "@mindedge/vue-api-query": "^1.14.0",
39
40
  "@nuxtjs/axios": "^5.13.6",
40
41
  "@types/lodash": "^4.14.180",
41
42
  "@vue/cli-plugin-babel": "^5.0.4",
@@ -52,7 +53,6 @@
52
53
  "ts-jest": "^26.5.6",
53
54
  "typescript": "^4.6.3",
54
55
  "vue": "^2.6.14",
55
- "vue-api-query": "^1.11.0",
56
56
  "vue-jest": "^3.0.7",
57
57
  "vuetify": "^2.6.4"
58
58
  }
@@ -1,4 +1,4 @@
1
- import { Model as mockModel } from 'vue-api-query'
1
+ import { Model as mockModel } from '@mindedge/vue-api-query'
2
2
 
3
3
  import axios from 'axios'
4
4
  jest.mock('axios')
@@ -16,6 +16,10 @@ const unVerifiedGlossaryWordWithSpace =
16
16
  '<span class="glossary-word" aria-label="Glossary Term"> Climate </span>'
17
17
  const glossaryWord3 =
18
18
  '<span class="glossary-word" aria-label="Glossary Term">Crisis change</span>'
19
+ const glossaryWord4 =
20
+ '<span class="glossary-word" aria-label="Glossary Term">architect</span>'
21
+ const glossaryWord5 =
22
+ '<span class="glossary-word" aria-label="Glossary Term">universe</span>'
19
23
  const glossaryWordSpaceBefore =
20
24
  '<span class="glossary-word" aria-label="Glossary Term"> Crisis change</span>'
21
25
  const glossaryWordSpaceAfter =
@@ -32,7 +36,7 @@ const glossary = [
32
36
  {
33
37
  term: 'Architecto',
34
38
  definition: 'Architecto is a word that means architect of the universe',
35
- alternate_forms: null,
39
+ alternate_forms: ['Architect', 'universe'],
36
40
  related_term: 'a,b,c,d',
37
41
  },
38
42
  {
@@ -47,7 +51,7 @@ const glossary = [
47
51
  {
48
52
  term: 'crisis change',
49
53
  definition: 'n/a',
50
- alternate_forms: null,
54
+ alternate_forms: ['crisis', 'change'],
51
55
  related_term: null,
52
56
  },
53
57
  ]
@@ -135,7 +139,14 @@ describe('GlossaryHelper ', () => {
135
139
  )
136
140
  ).toEqual([term])
137
141
  })
138
-
142
+ test('can retrieve verified glossary terms from alternate form ', () => {
143
+ expect(
144
+ GlossaryHelper.getContentVerifiedGlossaryTerms(
145
+ glossaryWord4 + contentHtml + glossaryWord5,
146
+ glossary
147
+ )
148
+ ).toEqual([term])
149
+ })
139
150
  test('can retrieve un-verified glossary terms', () => {
140
151
  expect(
141
152
  GlossaryHelper.getContentUnVerifiedGlossaryTerms(
@@ -144,6 +155,14 @@ describe('GlossaryHelper ', () => {
144
155
  )
145
156
  ).toEqual([new GlossaryTerm({ term: 'unverified', definition: 'n/a' })])
146
157
  })
158
+ test('does not mistake alternate forms for un-verified glossary terms', () => {
159
+ expect(
160
+ GlossaryHelper.getContentUnVerifiedGlossaryTerms(
161
+ glossaryWord2 + contentHtml + glossaryWord4,
162
+ glossary
163
+ )
164
+ ).toEqual([new GlossaryTerm({ term: 'unverified', definition: 'n/a' })])
165
+ })
147
166
 
148
167
  test('can retrieve un-verified glossary terms with space', () => {
149
168
  expect(
package/test/mocks.js CHANGED
@@ -55,6 +55,14 @@ const mocks = {
55
55
  window: {},
56
56
  app: {},
57
57
  $router: [],
58
+ $Validation: {
59
+ getRule() {},
60
+ getLimit() {},
61
+ addLimit() {},
62
+ addRule() {},
63
+ addLimits() {},
64
+ addRules() {},
65
+ },
58
66
  $PluginService: { mounted: () => {} },
59
67
  $PermissionService: { userHasAccessTo: () => {} },
60
68
  $Grading: {