@windward/core 0.0.8 → 0.0.9

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 (175) hide show
  1. package/components/Content/Blocks/ClickableIcons.vue +128 -40
  2. package/components/Content/Blocks/Image.vue +2 -2
  3. package/components/Content/Blocks/ScenarioChoice.vue +262 -0
  4. package/components/Content/Blocks/Tab.vue +2 -7
  5. package/components/Settings/AccordionSettings.vue +97 -74
  6. package/components/Settings/ClickableIconsSettings.vue +101 -86
  7. package/components/Settings/ScenarioChoiceSettings.vue +329 -0
  8. package/components/Settings/TabSettings.vue +75 -61
  9. package/components/Settings/TextEditorSettings.vue +1 -3
  10. package/components/utils/FillInBlank/FillInBlankInput.vue +4 -1
  11. package/components/utils/TinyMCEWrapper.vue +1 -1
  12. package/helpers/FillInBlankHelper.ts +0 -2
  13. package/i18n/en-US/components/content/blocks/index.ts +2 -2
  14. package/i18n/en-US/components/content/blocks/scenario_choice.ts +5 -0
  15. package/i18n/en-US/components/settings/accordion.ts +5 -0
  16. package/i18n/en-US/components/settings/clickable_icon.ts +8 -0
  17. package/i18n/en-US/components/settings/index.ts +6 -0
  18. package/i18n/en-US/components/settings/scenario_choice.ts +19 -0
  19. package/i18n/en-US/components/settings/tab.ts +7 -0
  20. package/i18n/en-US/components/utils/FillInBlank/FillInBlankInput.ts +1 -1
  21. package/i18n/en-US/shared/content_blocks.ts +1 -0
  22. package/i18n/en-US/shared/settings.ts +2 -0
  23. package/i18n/es-ES/components/content/blocks/feedback.ts +2 -0
  24. package/i18n/es-ES/components/content/blocks/index.ts +2 -2
  25. package/i18n/es-ES/components/content/blocks/scenario_choice.ts +6 -0
  26. package/i18n/es-ES/components/navigation/index.ts +2 -0
  27. package/i18n/es-ES/components/settings/accordion.ts +5 -0
  28. package/i18n/es-ES/components/settings/clickable_icon.ts +8 -0
  29. package/i18n/es-ES/components/settings/index.ts +6 -0
  30. package/i18n/es-ES/components/settings/scenario_choice.ts +19 -0
  31. package/i18n/es-ES/components/{content/blocks → settings}/tab.ts +3 -0
  32. package/i18n/es-ES/components/utils/FillInBlank/FillInBlankInput.ts +13 -0
  33. package/i18n/es-ES/components/utils/FillInBlank/FillInTheBlanksManager.ts +11 -0
  34. package/i18n/es-ES/components/utils/FillInBlank/index.ts +6 -0
  35. package/i18n/es-ES/components/utils/index.ts +2 -0
  36. package/i18n/es-ES/components/utils/tiny_mce_wrapper.ts +1 -0
  37. package/i18n/es-ES/shared/content_blocks.ts +1 -0
  38. package/i18n/es-ES/shared/menu.ts +1 -0
  39. package/i18n/es-ES/shared/settings.ts +2 -0
  40. package/i18n/index.ts +11 -0
  41. package/i18n/sv-SE/components/content/blocks/feedback.ts +2 -0
  42. package/i18n/sv-SE/components/content/blocks/index.ts +2 -2
  43. package/i18n/sv-SE/components/content/blocks/scenario_choice.ts +5 -0
  44. package/i18n/sv-SE/components/navigation/index.ts +2 -0
  45. package/i18n/sv-SE/components/settings/accordion.ts +5 -0
  46. package/i18n/sv-SE/components/settings/clickable_icon.ts +8 -0
  47. package/i18n/sv-SE/components/settings/index.ts +6 -0
  48. package/i18n/sv-SE/components/settings/scenario_choice.ts +19 -0
  49. package/i18n/sv-SE/components/{content/blocks → settings}/tab.ts +3 -0
  50. package/i18n/sv-SE/components/utils/FillInBlank/FillInBlankInput.ts +13 -0
  51. package/i18n/sv-SE/components/utils/FillInBlank/FillInTheBlanksManager.ts +11 -0
  52. package/i18n/sv-SE/components/utils/FillInBlank/index.ts +6 -0
  53. package/i18n/sv-SE/components/utils/index.ts +2 -0
  54. package/i18n/sv-SE/components/utils/tiny_mce_wrapper.ts +1 -0
  55. package/i18n/sv-SE/shared/content_blocks.ts +1 -0
  56. package/i18n/sv-SE/shared/menu.ts +1 -0
  57. package/i18n/sv-SE/shared/settings.ts +2 -0
  58. package/package.json +2 -1
  59. package/plugin.js +24 -5
  60. package/test/Components/Content/Blocks/ScenarioChoice.spec.js +21 -0
  61. package/test/Components/Settings/ClickableIconsSettings.spec.js +1 -1
  62. package/test/Components/Settings/ScenarioChoiceSettings.spec.js +20 -0
  63. package/test/Feature/LocaleKeys.spec.js +9 -0
  64. package/test/__mocks__/componentsMock.js +24 -0
  65. package/test/locales.js +95 -0
  66. package/.idea/codeStyles/Project.xml +0 -58
  67. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  68. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  69. package/.idea/modules.xml +0 -8
  70. package/.idea/php-docker-settings.xml +0 -24
  71. package/.idea/php.xml +0 -19
  72. package/.idea/vcs.xml +0 -6
  73. package/.idea/watcherTasks.xml +0 -4
  74. package/.idea/windward-ui-plugin-core.iml +0 -8
  75. package/coverage/clover.xml +0 -223
  76. package/coverage/coverage-final.json +0 -16
  77. package/coverage/lcov-report/base.css +0 -224
  78. package/coverage/lcov-report/block-navigation.js +0 -87
  79. package/coverage/lcov-report/components/Content/Blocks/Accordion.vue.html +0 -430
  80. package/coverage/lcov-report/components/Content/Blocks/Image.vue.html +0 -394
  81. package/coverage/lcov-report/components/Content/Blocks/Math.vue.html +0 -262
  82. package/coverage/lcov-report/components/Content/Blocks/RichText.vue.html +0 -295
  83. package/coverage/lcov-report/components/Content/Blocks/Tab.vue.html +0 -415
  84. package/coverage/lcov-report/components/Content/Blocks/Table.vue.html +0 -667
  85. package/coverage/lcov-report/components/Content/Blocks/Video.vue.html +0 -2275
  86. package/coverage/lcov-report/components/Content/Blocks/index.html +0 -206
  87. package/coverage/lcov-report/components/utils/ContentViewer.vue.html +0 -199
  88. package/coverage/lcov-report/components/utils/MathExpressionEditor.vue.html +0 -919
  89. package/coverage/lcov-report/components/utils/MathLiveWrapper.vue.html +0 -343
  90. package/coverage/lcov-report/components/utils/TinyMCEWrapper.vue.html +0 -271
  91. package/coverage/lcov-report/components/utils/index.html +0 -161
  92. package/coverage/lcov-report/config/index.html +0 -116
  93. package/coverage/lcov-report/config/tinymce.config.js.html +0 -493
  94. package/coverage/lcov-report/favicon.png +0 -0
  95. package/coverage/lcov-report/helpers/MathHelper.ts.html +0 -793
  96. package/coverage/lcov-report/helpers/index.html +0 -116
  97. package/coverage/lcov-report/helpers/tinymce/index.html +0 -116
  98. package/coverage/lcov-report/helpers/tinymce/plugin.ts.html +0 -334
  99. package/coverage/lcov-report/index.html +0 -191
  100. package/coverage/lcov-report/prettify.css +0 -1
  101. package/coverage/lcov-report/prettify.js +0 -2
  102. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  103. package/coverage/lcov-report/sorter.js +0 -196
  104. package/coverage/lcov-report/test/index.html +0 -116
  105. package/coverage/lcov-report/test/mocks.js.html +0 -457
  106. package/coverage/lcov.info +0 -403
  107. package/i18n/en-US/components/content/blocks/tab.ts +0 -4
  108. package/lib/helpers/GlossaryHelper.d.ts +0 -9
  109. package/lib/helpers/GlossaryHelper.js +0 -118
  110. package/lib/helpers/GlossaryTerm.d.ts +0 -10
  111. package/lib/helpers/GlossaryTerm.js +0 -22
  112. package/lib/helpers/MathHelper.d.ts +0 -99
  113. package/lib/helpers/MathHelper.js +0 -194
  114. package/lib/helpers/tinymce/plugin.d.ts +0 -2
  115. package/lib/helpers/tinymce/plugin.js +0 -86
  116. package/lib/i18n/en-US/components/content/blocks/image.d.ts +0 -6
  117. package/lib/i18n/en-US/components/content/blocks/image.js +0 -7
  118. package/lib/i18n/en-US/components/content/blocks/index.d.ts +0 -75
  119. package/lib/i18n/en-US/components/content/blocks/index.js +0 -14
  120. package/lib/i18n/en-US/components/content/blocks/tab.d.ts +0 -5
  121. package/lib/i18n/en-US/components/content/blocks/tab.js +0 -6
  122. package/lib/i18n/en-US/components/content/blocks/table.d.ts +0 -5
  123. package/lib/i18n/en-US/components/content/blocks/table.js +0 -6
  124. package/lib/i18n/en-US/components/content/blocks/user_upload.d.ts +0 -13
  125. package/lib/i18n/en-US/components/content/blocks/user_upload.js +0 -14
  126. package/lib/i18n/en-US/components/content/blocks/video.d.ts +0 -48
  127. package/lib/i18n/en-US/components/content/blocks/video.js +0 -49
  128. package/lib/i18n/en-US/components/content/index.d.ts +0 -77
  129. package/lib/i18n/en-US/components/content/index.js +0 -6
  130. package/lib/i18n/en-US/components/index.d.ts +0 -140
  131. package/lib/i18n/en-US/components/index.js +0 -12
  132. package/lib/i18n/en-US/components/navigation/image.d.ts +0 -5
  133. package/lib/i18n/en-US/components/navigation/image.js +0 -6
  134. package/lib/i18n/en-US/components/navigation/index.d.ts +0 -10
  135. package/lib/i18n/en-US/components/navigation/index.js +0 -8
  136. package/lib/i18n/en-US/components/navigation/user_upload.d.ts +0 -4
  137. package/lib/i18n/en-US/components/navigation/user_upload.js +0 -5
  138. package/lib/i18n/en-US/components/settings/clickable_icon.d.ts +0 -6
  139. package/lib/i18n/en-US/components/settings/clickable_icon.js +0 -7
  140. package/lib/i18n/en-US/components/settings/image.d.ts +0 -2
  141. package/lib/i18n/en-US/components/settings/image.js +0 -3
  142. package/lib/i18n/en-US/components/settings/index.d.ts +0 -39
  143. package/lib/i18n/en-US/components/settings/index.js +0 -14
  144. package/lib/i18n/en-US/components/settings/text_editor.d.ts +0 -8
  145. package/lib/i18n/en-US/components/settings/text_editor.js +0 -9
  146. package/lib/i18n/en-US/components/settings/user_upload.d.ts +0 -12
  147. package/lib/i18n/en-US/components/settings/user_upload.js +0 -13
  148. package/lib/i18n/en-US/components/settings/video.d.ts +0 -13
  149. package/lib/i18n/en-US/components/settings/video.js +0 -14
  150. package/lib/i18n/en-US/components/utils/index.d.ts +0 -15
  151. package/lib/i18n/en-US/components/utils/index.js +0 -6
  152. package/lib/i18n/en-US/components/utils/tiny_mce_wrapper.d.ts +0 -13
  153. package/lib/i18n/en-US/components/utils/tiny_mce_wrapper.js +0 -14
  154. package/lib/i18n/en-US/index.d.ts +0 -197
  155. package/lib/i18n/en-US/index.js +0 -16
  156. package/lib/i18n/en-US/modules/index.d.ts +0 -2
  157. package/lib/i18n/en-US/modules/index.js +0 -6
  158. package/lib/i18n/en-US/pages/glossary.d.ts +0 -8
  159. package/lib/i18n/en-US/pages/glossary.js +0 -9
  160. package/lib/i18n/en-US/pages/index.d.ts +0 -13
  161. package/lib/i18n/en-US/pages/index.js +0 -8
  162. package/lib/i18n/en-US/pages/user_upload.d.ts +0 -4
  163. package/lib/i18n/en-US/pages/user_upload.js +0 -5
  164. package/lib/i18n/en-US/shared/content_blocks.d.ts +0 -20
  165. package/lib/i18n/en-US/shared/content_blocks.js +0 -21
  166. package/lib/i18n/en-US/shared/index.d.ts +0 -39
  167. package/lib/i18n/en-US/shared/index.js +0 -10
  168. package/lib/i18n/en-US/shared/menu.d.ts +0 -4
  169. package/lib/i18n/en-US/shared/menu.js +0 -5
  170. package/lib/i18n/en-US/shared/settings.d.ts +0 -15
  171. package/lib/i18n/en-US/shared/settings.js +0 -16
  172. package/lib/i18n/en-US.d.ts +0 -197
  173. package/lib/i18n/en-US.js +0 -15
  174. package/lib/models/UserFileAsset.d.ts +0 -5
  175. package/lib/models/UserFileAsset.js +0 -37
@@ -0,0 +1,329 @@
1
+ <template>
2
+ <div>
3
+ <v-container>
4
+ <v-col class="pa-0">
5
+ <v-text-field
6
+ v-model="block.metadata.config.title"
7
+ id="title"
8
+ :label="
9
+ $t(
10
+ 'windward.core.components.settings.scenario_choice.title'
11
+ )
12
+ "
13
+ ></v-text-field>
14
+ <v-text-field
15
+ v-model="block.metadata.config.description"
16
+ id="description"
17
+ :label="
18
+ $t(
19
+ 'windward.core.components.settings.scenario_choice.description'
20
+ )
21
+ "
22
+ ></v-text-field>
23
+ <v-select
24
+ v-model="block.metadata.config.display_style"
25
+ :items="displayStyles"
26
+ :label="
27
+ $t(
28
+ 'windward.core.components.settings.scenario_choice.display_style'
29
+ )
30
+ "
31
+ ></v-select>
32
+ <v-switch
33
+ v-model="isLinked"
34
+ :label="
35
+ $t(
36
+ 'windward.core.components.settings.scenario_choice.is_linked'
37
+ )
38
+ "
39
+ @click="onClickLinkSwitch"
40
+ ></v-switch>
41
+
42
+ <v-switch
43
+ v-model="block.metadata.config.show_reset"
44
+ :label="
45
+ $t(
46
+ 'windward.core.components.settings.scenario_choice.show_reset'
47
+ )
48
+ "
49
+ ></v-switch>
50
+
51
+ <v-btn
52
+ color="primary"
53
+ outlined
54
+ block
55
+ :disabled="block.metadata.config.items.length > 26"
56
+ @click="onAddElement"
57
+ >
58
+ <v-icon>mdi-plus</v-icon>
59
+ <span v-if="block.metadata.config.items.length <= 26">
60
+ {{ $t('shared.forms.add') }}
61
+ </span>
62
+ <span v-else>
63
+ {{
64
+ $t(
65
+ 'windward.core.components.settings.scenario_choice.over_item_limit'
66
+ )
67
+ }}
68
+ </span>
69
+ </v-btn>
70
+ </v-col>
71
+ <v-col>
72
+ <SortableExpansionPanel
73
+ v-model="block.metadata.config.items"
74
+ @click:close="onRemoveElement"
75
+ >
76
+ <template #header="{ item }">
77
+ <span v-if="item.title">{{ item.title }}</span>
78
+ <span v-else>
79
+ {{
80
+ $t(
81
+ 'windward.core.components.settings.scenario_choice.no_title'
82
+ )
83
+ }}
84
+ </span>
85
+ </template>
86
+ <template #body="{ index }">
87
+ <v-text-field
88
+ v-model="block.metadata.config.items[index].title"
89
+ :id="'item-' + index + '-title'"
90
+ :label="
91
+ $t(
92
+ 'windward.core.components.settings.scenario_choice.item_title'
93
+ )
94
+ "
95
+ ></v-text-field>
96
+
97
+ <v-switch
98
+ v-model="block.metadata.config.items[index].correct"
99
+ :label="
100
+ $t(
101
+ 'windward.core.components.settings.scenario_choice.correct_choice'
102
+ )
103
+ "
104
+ ></v-switch>
105
+
106
+ <span>{{
107
+ $t(
108
+ 'windward.core.components.settings.scenario_choice.item_text'
109
+ )
110
+ }}</span>
111
+ <TextEditor
112
+ v-model="block.metadata.config.items[index].body"
113
+ :height="200"
114
+ ></TextEditor>
115
+ </template>
116
+ </SortableExpansionPanel>
117
+ </v-col>
118
+ </v-container>
119
+
120
+ <Dialog
121
+ v-model="showLinkDialog"
122
+ :trigger="false"
123
+ action-save
124
+ @click:save="onSetLinkedContent"
125
+ >
126
+ <template #title>{{
127
+ $t(
128
+ 'windward.core.components.settings.scenario_choice.link_content'
129
+ )
130
+ }}</template>
131
+
132
+ <template #form="{ on, attrs }">
133
+ <v-form
134
+ v-model="linkDialogFormValid"
135
+ v-bind="attrs"
136
+ v-on="on"
137
+ @submit.prevent
138
+ @input="on['change:valid']($event)"
139
+ >
140
+ <v-text-field
141
+ v-model="block.metadata.config.link_text"
142
+ :rules="validation.existsRules"
143
+ :label="
144
+ $t(
145
+ 'windward.core.components.settings.scenario_choice.link_text'
146
+ )
147
+ "
148
+ ></v-text-field>
149
+ <v-treeview
150
+ v-model="selectedTreeviewContent"
151
+ selectable
152
+ selected-color="primary"
153
+ selection-type="independent"
154
+ return-object
155
+ open-all
156
+ :items="contentTree"
157
+ @input="onTreeChange(attrs.ref)"
158
+ >
159
+ <template #label="{ item }">
160
+ <span
161
+ :class="
162
+ selectedTreeviewContent.length === 0
163
+ ? 'error--text'
164
+ : ''
165
+ "
166
+ >
167
+ {{ item.content.name_prefix }}
168
+ {{ item.content.name }}
169
+ </span>
170
+ </template>
171
+ </v-treeview>
172
+ </v-form>
173
+ </template>
174
+ </Dialog>
175
+ </div>
176
+ </template>
177
+ <script>
178
+ import _ from 'lodash'
179
+ import { mapGetters } from 'vuex'
180
+ import BaseContentSettings from '~/components/Content/Tool/BaseContentSettings.js'
181
+ import TextEditor from '~/components/Text/TextEditor'
182
+ import SortableExpansionPanel from '~/components/SortableExpansionPanel.vue'
183
+ import Dialog from '~/components/Dialog.vue'
184
+
185
+ export default {
186
+ name: 'ScenarioChoiceSettings',
187
+ components: {
188
+ SortableExpansionPanel,
189
+ TextEditor,
190
+ Dialog,
191
+ },
192
+ extends: BaseContentSettings,
193
+ computed: {
194
+ ...mapGetters({
195
+ contentTree: 'content/getTree',
196
+ }),
197
+ },
198
+ data() {
199
+ return {
200
+ isLinked: false,
201
+ showLinkDialog: false,
202
+ linkDialogFormValid: false,
203
+ selectedTreeviewContent: [],
204
+ validation: {
205
+ existsRules: [
206
+ (v) =>
207
+ (!!v && !!this.block.metadata.config.link_content_id) ||
208
+ this.$t(
209
+ 'windward.core.components.settings.scenario_choice.link_required'
210
+ ),
211
+ ],
212
+ },
213
+ displayStyles: [
214
+ {
215
+ text: this.$t(
216
+ 'windward.core.components.settings.scenario_choice.style.letter'
217
+ ),
218
+ value: 'letter',
219
+ },
220
+ {
221
+ text: this.$t(
222
+ 'windward.core.components.settings.scenario_choice.style.number'
223
+ ),
224
+ value: 'number',
225
+ },
226
+ ],
227
+ }
228
+ },
229
+ beforeMount() {
230
+ if (_.isEmpty(this.block)) {
231
+ this.block = {}
232
+ }
233
+ if (_.isEmpty(this.block.body)) {
234
+ this.block.body = 'scenario choice'
235
+ }
236
+ if (_.isEmpty(this.block.metadata)) {
237
+ this.block.metadata = {}
238
+ }
239
+ if (_.isEmpty(this.block.metadata.config)) {
240
+ this.block.metadata.config = {}
241
+ }
242
+ if (_.isEmpty(this.block.metadata.config.title)) {
243
+ this.block.metadata.config.title = ''
244
+ }
245
+ if (_.isEmpty(this.block.metadata.config.description)) {
246
+ this.block.metadata.config.description = ''
247
+ }
248
+ if (_.isEmpty(this.block.metadata.config.display_style)) {
249
+ this.block.metadata.config.display_style = 'letter'
250
+ }
251
+ if (_.isEmpty(this.block.metadata.config.link_content_id)) {
252
+ this.block.metadata.config.link_content_id = null
253
+ }
254
+ if (_.isEmpty(this.block.metadata.config.link_text)) {
255
+ this.block.metadata.config.link_text = null
256
+ }
257
+ if (!_.isBoolean(this.block.metadata.config.show_reset)) {
258
+ this.block.metadata.config.show_reset = false
259
+ }
260
+ if (_.isEmpty(this.block.metadata.config.items)) {
261
+ this.block.metadata.config.items = []
262
+ }
263
+ },
264
+ mounted() {
265
+ if (this.block.metadata.config.items.length <= 0) {
266
+ this.onAddElement()
267
+ }
268
+ this.isLinked =
269
+ !_.isEmpty(this.block.metadata.config.link_content_id) &&
270
+ !_.isEmpty(this.block.metadata.config.link_text)
271
+ },
272
+ methods: {
273
+ onAddElement() {
274
+ const defaultObject = {
275
+ title: '',
276
+ body: '<p></p>',
277
+ correct: false,
278
+ }
279
+ this.block.metadata.config.items.push(defaultObject)
280
+ },
281
+ onRemoveElement(index) {
282
+ this.block.metadata.config.items.splice(index, 1)
283
+ },
284
+ onClickLinkSwitch() {
285
+ // Show the dialog to set the links
286
+ if (this.isLinked) {
287
+ this.showLinkDialog = true
288
+ this.$nextTick(() => {
289
+ this.isLinked = false
290
+ })
291
+ } else {
292
+ // clear the links
293
+ this.block.metadata.config.link_content_id = null
294
+ this.block.metadata.config.link_text = null
295
+ this.selectedTreeviewContent.splice(0)
296
+ }
297
+ },
298
+ onTreeChange(ref) {
299
+ // Enforce that only 1 item is selected at a time in the treeview
300
+ if (this.selectedTreeviewContent.length > 0) {
301
+ const last = this.selectedTreeviewContent.pop()
302
+ this.selectedTreeviewContent = [last]
303
+ }
304
+
305
+ // Set the actual content id for this link
306
+ this.block.metadata.config.link_content_id = _.get(
307
+ this.selectedTreeviewContent,
308
+ '[0].content_id',
309
+ null
310
+ )
311
+
312
+ // Validate the other form forms
313
+ this.$refs[ref].validate()
314
+
315
+ // Overwrite the validation since treeview doesn't implement rules
316
+ if (this.block.metadata.config.link_text) {
317
+ this.$refs[ref].$emit('input', true)
318
+ } else {
319
+ this.$refs[ref].$emit('input', false)
320
+ }
321
+ },
322
+ onSetLinkedContent() {
323
+ this.isLinked =
324
+ !_.isEmpty(this.block.metadata.config.link_content_id) &&
325
+ !_.isEmpty(this.block.metadata.config.link_text)
326
+ },
327
+ },
328
+ }
329
+ </script>
@@ -1,60 +1,69 @@
1
1
  <template>
2
2
  <div>
3
- <v-btn color="primary" @click="onAddElement" class="fullWidth">
4
- <v-icon>mdi-plus</v-icon>
5
- {{ $t('windward.core.components.content.blocks.tab.add_tab') }}
6
- </v-btn>
7
- <v-expansion-panels flat v-model="block.metadata.config.tab">
8
- <v-expansion-panel
9
- v-for="(item, itemIndex) in block.metadata.config.items"
10
- :key="itemIndex"
11
- class="elevation-0"
3
+ <v-form ref="form" v-model="valid" v-if="!loading">
4
+ <v-divider class="my-4 primary"></v-divider>
5
+ <p>{{ $t('windward.core.components.settings.tab.tabs') }}</p>
6
+ <SortableExpansionPanel
7
+ v-model="block.metadata.config.items"
8
+ @click:close="onRemoveElement($event)"
9
+ :copy="false"
12
10
  >
13
- <v-expansion-panel-header>{{
14
- 'Tab ' + (itemIndex + 1)
15
- }}</v-expansion-panel-header>
16
- <v-expansion-panel-content :key="expansionPanelKey">
17
- <v-text-field
18
- v-model="
19
- block.metadata.config.items[itemIndex].tabHeader
20
- "
21
- :placeholder="'item ' + (itemIndex + 1)"
22
- ></v-text-field>
23
- <v-btn @click="onToggleExpand(item)" class="mb-3">
24
- <v-icon
25
- v-if="
26
- !block.metadata.config.items[itemIndex].expand
11
+ <template #header="{ item, index }">
12
+ {{ item.tabHeader !== '' ? item.tabHeader : 'No Header' }}
13
+ </template>
14
+ <template #body="{ item, index }">
15
+ <v-container :key="expansionPanelKey">
16
+ <p class="p-label">
17
+ {{
18
+ $t(
19
+ 'windward.core.components.settings.tab.header'
20
+ )
21
+ }}
22
+ </p>
23
+ <v-text-field
24
+ outlined
25
+ :autofocus="true"
26
+ v-model="
27
+ block.metadata.config.items[index].tabHeader
27
28
  "
28
- >mdi-arrow-expand-all</v-icon
29
- >
30
- <v-icon
31
- v-if="block.metadata.config.items[itemIndex].expand"
32
- >
33
- mdi-arrow-collapse-all
34
- </v-icon>
35
- </v-btn>
36
- <br />
37
- <TextEditor
38
- :api_key="api_key"
39
- v-model="block.metadata.config.items[itemIndex].content"
40
- v-show="!block.metadata.config.items[itemIndex].expand"
41
- ></TextEditor>
42
- <br />
43
- <v-btn
44
- color="primary"
45
- @click="onRemoveElement(itemIndex)"
46
- class="fullWidth"
47
- >
48
- <v-icon>mdi-minus</v-icon>
49
- {{
50
- $t(
51
- 'windward.core.components.content.blocks.tab.delete_tab'
52
- )
53
- }}
54
- </v-btn>
55
- </v-expansion-panel-content>
56
- </v-expansion-panel>
57
- </v-expansion-panels>
29
+ :placeholder="'item ' + (index + 1)"
30
+ ></v-text-field>
31
+ <v-btn @click="onToggleExpand(index)" class="mb-3">
32
+ <v-icon
33
+ v-if="
34
+ !block.metadata.config.items[index].expand
35
+ "
36
+ >mdi-arrow-expand-all</v-icon
37
+ >
38
+ <v-icon
39
+ v-if="block.metadata.config.items[index].expand"
40
+ >
41
+ mdi-arrow-collapse-all
42
+ </v-icon>
43
+ </v-btn>
44
+ <TextEditor
45
+ :api_key="api_key"
46
+ v-model="block.metadata.config.items[index].content"
47
+ v-if="!item.expand"
48
+ ></TextEditor>
49
+ </v-container>
50
+ </template>
51
+ </SortableExpansionPanel>
52
+ <v-row justify="center" class="my-4">
53
+ <v-btn color="primary" @click="onAddElement">
54
+ <v-icon>mdi-plus</v-icon>
55
+ {{ $t('windward.core.components.settings.tab.add_tab') }}
56
+ </v-btn>
57
+ </v-row>
58
+ </v-form>
59
+ <div v-if="loading" class="text-center">
60
+ <v-progress-circular
61
+ :size="70"
62
+ :width="7"
63
+ color="primary"
64
+ indeterminate
65
+ ></v-progress-circular>
66
+ </div>
58
67
  </div>
59
68
  </template>
60
69
 
@@ -63,17 +72,20 @@ import _, { get } from 'lodash'
63
72
  import Crypto from '~/helpers/Crypto'
64
73
  import TextEditor from '~/components/Text/TextEditor.vue'
65
74
  import BaseContentSettings from '~/components/Content/Tool/BaseContentSettings.js'
75
+ import SortableExpansionPanel from '~/components/SortableExpansionPanel.vue'
66
76
 
67
77
  export default {
68
78
  name: 'TabSettings',
69
- components: { TextEditor },
79
+ components: { TextEditor, SortableExpansionPanel },
70
80
  extends: BaseContentSettings,
71
81
  beforeMount() {
72
82
  if (_.isEmpty(this.block)) {
73
83
  this.block = {}
74
84
  }
75
85
  if (_.isEmpty(this.block.body)) {
76
- this.block.body = ''
86
+ this.block.body = this.$t(
87
+ 'windward.core.components.settings.tab.tab'
88
+ )
77
89
  }
78
90
  if (_.isEmpty(this.block.metadata)) {
79
91
  this.block.metadata = {}
@@ -93,12 +105,13 @@ export default {
93
105
  this.block.metadata.config.items = []
94
106
  this.block.metadata.config.items.push(defaultObject)
95
107
  }
96
- this.block.body = 'tab'
97
108
  },
98
109
  data() {
99
110
  return {
100
111
  expansionPanelKey: '0',
101
112
  api_key: process.env.TINY_MCE_API_KEY,
113
+ valid: true,
114
+ loading: false,
102
115
  }
103
116
  },
104
117
  mounted() {
@@ -111,7 +124,6 @@ export default {
111
124
  clearTimeout(this.debouncer)
112
125
  }
113
126
  },
114
-
115
127
  methods: {
116
128
  onAddElement() {
117
129
  const defaultObject = {
@@ -125,9 +137,10 @@ export default {
125
137
  this.block.metadata.config.items.splice(index, 1)
126
138
  this.expansionPanelKey = Crypto.id()
127
139
  },
128
- onToggleExpand(item) {
140
+ onToggleExpand(index) {
129
141
  this.expansionPanelKey = Crypto.id()
130
- return (item.expand = !item.expand)
142
+ return (this.block.metadata.config.items[index].expand =
143
+ !this.block.metadata.config.items[index].expand)
131
144
  },
132
145
  },
133
146
  }
@@ -136,7 +149,8 @@ export default {
136
149
  .v-progress-circular {
137
150
  margin: 1rem;
138
151
  }
139
- .fullWidth {
140
- width: 100%;
152
+ .p-label {
153
+ font-size: 16px;
154
+ font-weight: 500;
141
155
  }
142
156
  </style>
@@ -100,9 +100,7 @@
100
100
  <br />
101
101
  <text-editor
102
102
  v-model="block.body"
103
- v-show="
104
- settingSelector.includes(1) && !block.metadata.config.expand
105
- "
103
+ v-if="settingSelector.includes(1) && !block.metadata.config.expand"
106
104
  autofill
107
105
  ></text-editor>
108
106
  <v-skeleton-loader
@@ -133,7 +133,10 @@ export default {
133
133
 
134
134
  computed: {
135
135
  answerIsCorrect() {
136
- if (_.toLower(this.answer) === _.toLower(this.userInput)) {
136
+ if (
137
+ _.trim(_.toLower(this.answer)) ===
138
+ _.trim(_.toLower(this.userInput))
139
+ ) {
137
140
  return true
138
141
  }
139
142
  return false
@@ -190,7 +190,7 @@ export default {
190
190
  contenteditable: 'true',
191
191
  'data-feedback': btoa(
192
192
  this.$t(
193
- 'windward.core.components.utils.fill_in_the_blank.fill_in_blank_input.default.description'
193
+ 'windward.core.components.utils.fill_in_the_blank.fill_in_blank_input.default_description'
194
194
  )
195
195
  ),
196
196
  },
@@ -1,5 +1,3 @@
1
- import * as _ from "lodash";
2
- import GlossaryTerm from "~/helpers/GlossaryTerm";
3
1
 
4
2
  export default class FillInBlankHelper {
5
3
 
@@ -2,18 +2,18 @@ import user_upload from './user_upload'
2
2
  import image from './image'
3
3
  import video from './video'
4
4
  import table from './table'
5
- import tab from './tab'
6
5
  import feedback from './feedback'
7
6
  import open_response from './open_response'
8
7
  import open_response_collate from './open_response_collate'
8
+ import scenarioChoice from './scenario_choice'
9
9
 
10
10
  export default {
11
11
  user_upload,
12
12
  image,
13
13
  video,
14
14
  table,
15
- tab,
16
15
  feedback,
17
16
  open_response,
18
17
  open_response_collate,
18
+ scenario_choice: scenarioChoice,
19
19
  }
@@ -0,0 +1,5 @@
1
+ export default {
2
+ information: 'Click one of the items below to make a choice.',
3
+ try_again: 'Try again',
4
+ selected_choice: 'Your choice',
5
+ }
@@ -0,0 +1,5 @@
1
+ export default {
2
+ items: 'Accordion Items',
3
+ add: 'Add Accordion',
4
+ accordion: 'Accordion',
5
+ }
@@ -2,8 +2,16 @@ export default {
2
2
  title: 'Title',
3
3
  description: 'Description',
4
4
  information: 'Click on each of the list items below for more information.',
5
+ no_icon: 'No Icon',
5
6
  item_icon: 'Item {0} icon',
6
7
  item_title: 'Item Title',
7
8
  item_color: 'Item Color',
8
9
  item_text: 'Item Text',
10
+ autocolor: 'Auto-color Options',
11
+ display: {
12
+ show_title: 'Always Show Title',
13
+ show_background: 'Show Background',
14
+ round_icon: 'Round Icons',
15
+ italic_icon: 'Italic Icons',
16
+ },
9
17
  }
@@ -5,13 +5,19 @@ import video from './video'
5
5
  import clickable_icon from './clickable_icon'
6
6
  import open_response from './open_response'
7
7
  import open_response_collate from './open_response_collate'
8
+ import scenarioChoice from './scenario_choice'
9
+ import accordion from './accordion'
10
+ import tab from './tab'
8
11
 
9
12
  export default {
13
+ accordion,
10
14
  image,
11
15
  user_upload,
12
16
  text_editor,
17
+ tab,
13
18
  video,
14
19
  clickable_icon,
15
20
  open_response,
16
21
  open_response_collate,
22
+ scenario_choice: scenarioChoice,
17
23
  }
@@ -0,0 +1,19 @@
1
+ export default {
2
+ title: 'Title',
3
+ description: 'Description',
4
+ over_item_limit: 'Cannot add more items',
5
+ no_title: 'No Title',
6
+ item_title: 'Item Title',
7
+ item_text: 'Item Text',
8
+ correct_choice: 'Is Correct Choice',
9
+ show_reset: 'Allow Retries',
10
+ display_style: 'Display Style',
11
+ is_linked: 'Block links to a page',
12
+ link_content: 'Link Content',
13
+ link_text: 'Link Text',
14
+ link_required: 'Link text and target page are required',
15
+ style: {
16
+ letter: 'Letters',
17
+ number: 'Numbers',
18
+ },
19
+ }
@@ -0,0 +1,7 @@
1
+ export default {
2
+ tab: 'Tab',
3
+ tabs: 'Tabs',
4
+ header: 'Tab Header',
5
+ add_tab: 'Add Tab',
6
+ delete_tab: 'Delete Tab',
7
+ }
@@ -5,7 +5,7 @@ export default {
5
5
  check_answer: 'Click to check answer',
6
6
  close: 'Close',
7
7
  correct: 'Correct',
8
- default_description: 'default description',
8
+ default_description: 'Your input is correct',
9
9
  incorrect: 'Incorrect',
10
10
  input_incorrect: "'{0}' is incorrect",
11
11
  reset: 'reset',