@windward/core 0.6.0 → 0.7.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 (158) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/components/Content/Blocks/Accordion.vue +14 -0
  3. package/components/Content/Blocks/ClickableIcons.vue +9 -2
  4. package/components/Content/Blocks/Email.vue +11 -2
  5. package/components/Content/Blocks/GenerateAIQuestionButton.vue +14 -6
  6. package/components/Content/Blocks/HorizontalRule.vue +1 -4
  7. package/components/Content/Blocks/ScenarioChoice.vue +57 -32
  8. package/components/Content/Blocks/Tab.vue +5 -0
  9. package/components/Content/Blocks/UserUpload.vue +1 -8
  10. package/components/Content/Blocks/Video.vue +96 -8
  11. package/components/Settings/AccordionSettings.vue +61 -8
  12. package/components/Settings/BlockQuoteSettings.vue +20 -12
  13. package/components/Settings/ClickableIconsSettings.vue +48 -12
  14. package/components/Settings/EmailSettings.vue +20 -12
  15. package/components/Settings/FileDownloadSettings.vue +22 -16
  16. package/components/Settings/HorizontalRuleSettings.vue +0 -3
  17. package/components/Settings/ScenarioChoiceSettings.vue +29 -14
  18. package/components/Settings/TabSettings.vue +121 -78
  19. package/components/Settings/UserUploadSettings.vue +30 -32
  20. package/components/Settings/VideoSettings/SourcePicker.vue +222 -0
  21. package/components/Settings/VideoSettings.vue +139 -183
  22. package/components/utils/TinyMCEWrapper.vue +3 -2
  23. package/components/utils/assets/tinymce/content/global.scss +14 -0
  24. package/components/utils/glossary/CourseGlossary.vue +52 -27
  25. package/helpers/tinymce/WindwardPlugins.ts +59 -10
  26. package/i18n/en-US/components/content/blocks/generate_questions.ts +2 -1
  27. package/i18n/en-US/components/content/blocks/video.ts +2 -51
  28. package/i18n/en-US/components/settings/accordion.ts +1 -0
  29. package/i18n/en-US/components/settings/tab.ts +1 -0
  30. package/i18n/en-US/components/settings/user_upload.ts +1 -0
  31. package/i18n/en-US/components/settings/video.ts +51 -0
  32. package/i18n/en-US/components/utils/tiny_mce_wrapper.ts +9 -1
  33. package/i18n/es-ES/components/content/blocks/generate_questions.ts +2 -1
  34. package/i18n/es-ES/components/content/blocks/video.ts +3 -53
  35. package/i18n/es-ES/components/settings/accordion.ts +1 -0
  36. package/i18n/es-ES/components/settings/tab.ts +2 -0
  37. package/i18n/es-ES/components/settings/user_upload.ts +1 -0
  38. package/i18n/es-ES/components/settings/video.ts +53 -0
  39. package/i18n/es-ES/components/utils/tiny_mce_wrapper.ts +9 -0
  40. package/i18n/sv-SE/components/content/blocks/generate_questions.ts +2 -1
  41. package/i18n/sv-SE/components/content/blocks/video.ts +2 -51
  42. package/i18n/sv-SE/components/settings/accordion.ts +2 -0
  43. package/i18n/sv-SE/components/settings/tab.ts +1 -0
  44. package/i18n/sv-SE/components/settings/user_upload.ts +1 -0
  45. package/i18n/sv-SE/components/settings/video.ts +51 -0
  46. package/i18n/sv-SE/components/utils/tiny_mce_wrapper.ts +8 -0
  47. package/package.json +2 -1
  48. package/plugin.js +1 -1
  49. package/.idea/codeStyles/Project.xml +0 -58
  50. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  51. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  52. package/.idea/modules.xml +0 -8
  53. package/.idea/php-docker-settings.xml +0 -24
  54. package/.idea/php.xml +0 -19
  55. package/.idea/vcs.xml +0 -6
  56. package/.idea/watcherTasks.xml +0 -4
  57. package/.idea/windward-ui-plugin-core.iml +0 -8
  58. package/config/menu.config.json +0 -475
  59. package/coverage/clover.xml +0 -223
  60. package/coverage/coverage-final.json +0 -16
  61. package/coverage/lcov-report/base.css +0 -224
  62. package/coverage/lcov-report/block-navigation.js +0 -87
  63. package/coverage/lcov-report/components/Content/Blocks/Accordion.vue.html +0 -430
  64. package/coverage/lcov-report/components/Content/Blocks/Image.vue.html +0 -394
  65. package/coverage/lcov-report/components/Content/Blocks/Math.vue.html +0 -262
  66. package/coverage/lcov-report/components/Content/Blocks/RichText.vue.html +0 -295
  67. package/coverage/lcov-report/components/Content/Blocks/Tab.vue.html +0 -415
  68. package/coverage/lcov-report/components/Content/Blocks/Table.vue.html +0 -667
  69. package/coverage/lcov-report/components/Content/Blocks/Video.vue.html +0 -2275
  70. package/coverage/lcov-report/components/Content/Blocks/index.html +0 -206
  71. package/coverage/lcov-report/components/utils/ContentViewer.vue.html +0 -199
  72. package/coverage/lcov-report/components/utils/MathExpressionEditor.vue.html +0 -919
  73. package/coverage/lcov-report/components/utils/MathLiveWrapper.vue.html +0 -343
  74. package/coverage/lcov-report/components/utils/TinyMCEWrapper.vue.html +0 -271
  75. package/coverage/lcov-report/components/utils/index.html +0 -161
  76. package/coverage/lcov-report/config/index.html +0 -116
  77. package/coverage/lcov-report/config/tinymce.config.js.html +0 -493
  78. package/coverage/lcov-report/favicon.png +0 -0
  79. package/coverage/lcov-report/helpers/MathHelper.ts.html +0 -793
  80. package/coverage/lcov-report/helpers/index.html +0 -116
  81. package/coverage/lcov-report/helpers/tinymce/index.html +0 -116
  82. package/coverage/lcov-report/helpers/tinymce/plugin.ts.html +0 -334
  83. package/coverage/lcov-report/index.html +0 -191
  84. package/coverage/lcov-report/prettify.css +0 -1
  85. package/coverage/lcov-report/prettify.js +0 -2
  86. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  87. package/coverage/lcov-report/sorter.js +0 -196
  88. package/coverage/lcov-report/test/index.html +0 -116
  89. package/coverage/lcov-report/test/mocks.js.html +0 -457
  90. package/coverage/lcov.info +0 -403
  91. package/lib/helpers/GlossaryHelper.d.ts +0 -9
  92. package/lib/helpers/GlossaryHelper.js +0 -118
  93. package/lib/helpers/GlossaryTerm.d.ts +0 -10
  94. package/lib/helpers/GlossaryTerm.js +0 -22
  95. package/lib/helpers/MathHelper.d.ts +0 -99
  96. package/lib/helpers/MathHelper.js +0 -194
  97. package/lib/helpers/tinymce/plugin.d.ts +0 -2
  98. package/lib/helpers/tinymce/plugin.js +0 -86
  99. package/lib/i18n/en-US/components/content/blocks/image.d.ts +0 -6
  100. package/lib/i18n/en-US/components/content/blocks/image.js +0 -7
  101. package/lib/i18n/en-US/components/content/blocks/index.d.ts +0 -75
  102. package/lib/i18n/en-US/components/content/blocks/index.js +0 -14
  103. package/lib/i18n/en-US/components/content/blocks/tab.d.ts +0 -5
  104. package/lib/i18n/en-US/components/content/blocks/tab.js +0 -6
  105. package/lib/i18n/en-US/components/content/blocks/table.d.ts +0 -5
  106. package/lib/i18n/en-US/components/content/blocks/table.js +0 -6
  107. package/lib/i18n/en-US/components/content/blocks/user_upload.d.ts +0 -13
  108. package/lib/i18n/en-US/components/content/blocks/user_upload.js +0 -14
  109. package/lib/i18n/en-US/components/content/blocks/video.d.ts +0 -48
  110. package/lib/i18n/en-US/components/content/blocks/video.js +0 -49
  111. package/lib/i18n/en-US/components/content/index.d.ts +0 -77
  112. package/lib/i18n/en-US/components/content/index.js +0 -6
  113. package/lib/i18n/en-US/components/index.d.ts +0 -140
  114. package/lib/i18n/en-US/components/index.js +0 -12
  115. package/lib/i18n/en-US/components/navigation/image.d.ts +0 -5
  116. package/lib/i18n/en-US/components/navigation/image.js +0 -6
  117. package/lib/i18n/en-US/components/navigation/index.d.ts +0 -10
  118. package/lib/i18n/en-US/components/navigation/index.js +0 -8
  119. package/lib/i18n/en-US/components/navigation/user_upload.d.ts +0 -4
  120. package/lib/i18n/en-US/components/navigation/user_upload.js +0 -5
  121. package/lib/i18n/en-US/components/settings/clickable_icon.d.ts +0 -6
  122. package/lib/i18n/en-US/components/settings/clickable_icon.js +0 -7
  123. package/lib/i18n/en-US/components/settings/image.d.ts +0 -2
  124. package/lib/i18n/en-US/components/settings/image.js +0 -3
  125. package/lib/i18n/en-US/components/settings/index.d.ts +0 -39
  126. package/lib/i18n/en-US/components/settings/index.js +0 -14
  127. package/lib/i18n/en-US/components/settings/text_editor.d.ts +0 -8
  128. package/lib/i18n/en-US/components/settings/text_editor.js +0 -9
  129. package/lib/i18n/en-US/components/settings/user_upload.d.ts +0 -12
  130. package/lib/i18n/en-US/components/settings/user_upload.js +0 -13
  131. package/lib/i18n/en-US/components/settings/video.d.ts +0 -13
  132. package/lib/i18n/en-US/components/settings/video.js +0 -14
  133. package/lib/i18n/en-US/components/utils/index.d.ts +0 -15
  134. package/lib/i18n/en-US/components/utils/index.js +0 -6
  135. package/lib/i18n/en-US/components/utils/tiny_mce_wrapper.d.ts +0 -13
  136. package/lib/i18n/en-US/components/utils/tiny_mce_wrapper.js +0 -14
  137. package/lib/i18n/en-US/index.d.ts +0 -197
  138. package/lib/i18n/en-US/index.js +0 -16
  139. package/lib/i18n/en-US/modules/index.d.ts +0 -2
  140. package/lib/i18n/en-US/modules/index.js +0 -6
  141. package/lib/i18n/en-US/pages/glossary.d.ts +0 -8
  142. package/lib/i18n/en-US/pages/glossary.js +0 -9
  143. package/lib/i18n/en-US/pages/index.d.ts +0 -13
  144. package/lib/i18n/en-US/pages/index.js +0 -8
  145. package/lib/i18n/en-US/pages/user_upload.d.ts +0 -4
  146. package/lib/i18n/en-US/pages/user_upload.js +0 -5
  147. package/lib/i18n/en-US/shared/content_blocks.d.ts +0 -20
  148. package/lib/i18n/en-US/shared/content_blocks.js +0 -21
  149. package/lib/i18n/en-US/shared/index.d.ts +0 -39
  150. package/lib/i18n/en-US/shared/index.js +0 -10
  151. package/lib/i18n/en-US/shared/menu.d.ts +0 -4
  152. package/lib/i18n/en-US/shared/menu.js +0 -5
  153. package/lib/i18n/en-US/shared/settings.d.ts +0 -15
  154. package/lib/i18n/en-US/shared/settings.js +0 -16
  155. package/lib/i18n/en-US.d.ts +0 -197
  156. package/lib/i18n/en-US.js +0 -15
  157. package/lib/models/UserFileAsset.d.ts +0 -5
  158. package/lib/models/UserFileAsset.js +0 -37
@@ -142,6 +142,7 @@
142
142
  [index + 1]
143
143
  )
144
144
  "
145
+ :rules="validation.iconRules"
145
146
  :disabled="render"
146
147
  ></TextIconPicker>
147
148
 
@@ -238,20 +239,55 @@ export default {
238
239
  return {
239
240
  validation: {
240
241
  shortInputRules: [
241
- (v) =>
242
- v.length <= 50 ||
243
- this.$t(
244
- 'windward.core.shared.settings.errors.input_limitations',
245
- [50]
246
- ),
242
+ (v) => {
243
+ if (v) {
244
+ if (v.length <= 50) {
245
+ return true
246
+ } else {
247
+ return this.$t(
248
+ 'windward.core.shared.settings.errors.input_limitations',
249
+ [50]
250
+ )
251
+ }
252
+ } else {
253
+ return true
254
+ }
255
+ },
247
256
  ],
248
257
  instructionRule: [
249
- (v) =>
250
- v.length <= 255 ||
251
- this.$t(
252
- 'windward.core.shared.settings.errors.input_limitations',
253
- [255]
254
- ),
258
+ (v) => {
259
+ if (v) {
260
+ if (v.length <= 255) {
261
+ return true
262
+ } else {
263
+ return this.$t(
264
+ 'windward.core.shared.settings.errors.input_limitations',
265
+ [255]
266
+ )
267
+ }
268
+ } else {
269
+ return true
270
+ }
271
+ },
272
+ ],
273
+ iconRules: [
274
+ (v) => {
275
+ if (v) {
276
+ const isMDI = v.startsWith('mdi')
277
+ if (isMDI) {
278
+ return true
279
+ } else if (v.length >= 5) {
280
+ return this.$t(
281
+ 'shared.forms.errors.number_lt',
282
+ [4]
283
+ )
284
+ } else {
285
+ return true
286
+ }
287
+ } else {
288
+ return true
289
+ }
290
+ },
255
291
  ],
256
292
  },
257
293
  }
@@ -215,20 +215,28 @@ export default {
215
215
  editingPanel: 0,
216
216
  validation: {
217
217
  shortInputRules: [
218
- (v) =>
219
- v.length <= 50 ||
220
- this.$t(
221
- 'windward.core.shared.settings.errors.input_limitations',
222
- [50]
223
- ),
218
+ (v) => {
219
+ if (v && v.length >= 50) {
220
+ return this.$t(
221
+ 'windward.core.shared.settings.errors.input_limitations',
222
+ [50]
223
+ )
224
+ } else {
225
+ return true
226
+ }
227
+ },
224
228
  ],
225
229
  instructionRule: [
226
- (v) =>
227
- v.length <= 255 ||
228
- this.$t(
229
- 'windward.core.shared.settings.errors.input_limitations',
230
- [255]
231
- ),
230
+ (v) => {
231
+ if (v && v.length >= 255) {
232
+ return this.$t(
233
+ 'windward.core.shared.settings.errors.input_limitations',
234
+ [255]
235
+ )
236
+ } else {
237
+ return true
238
+ }
239
+ },
232
240
  ],
233
241
  },
234
242
  }
@@ -6,7 +6,7 @@
6
6
  :counter="50"
7
7
  :rules="validation.shortInputRules"
8
8
  :autofocus="true"
9
- :label="$t('components.content.settings.base.title_optional')"
9
+ :label="$t('components.content.settings.base.title')"
10
10
  :disabled="render"
11
11
  ></v-text-field>
12
12
  <v-textarea
@@ -15,9 +15,7 @@
15
15
  :counter="255"
16
16
  :rules="validation.instructionRule"
17
17
  :disabled="render"
18
- :label="
19
- $t('components.content.settings.base.instructions_optional')
20
- "
18
+ :label="$t('components.content.settings.base.instructions')"
21
19
  ></v-textarea>
22
20
  <v-switch
23
21
  v-model="block.metadata.config.display_detailed"
@@ -103,20 +101,28 @@ export default {
103
101
  return {
104
102
  validation: {
105
103
  shortInputRules: [
106
- (v) =>
107
- v.length <= 50 ||
108
- this.$t(
109
- 'windward.core.shared.settings.errors.input_limitations',
110
- [50]
111
- ),
104
+ (v) => {
105
+ if (v && v.length >= 50) {
106
+ return this.$t(
107
+ 'windward.core.shared.settings.errors.input_limitations',
108
+ [50]
109
+ )
110
+ } else {
111
+ return true
112
+ }
113
+ },
112
114
  ],
113
115
  instructionRule: [
114
- (v) =>
115
- v.length <= 255 ||
116
- this.$t(
117
- 'windward.core.shared.settings.errors.input_limitations',
118
- [255]
119
- ),
116
+ (v) => {
117
+ if (v && v.length >= 255) {
118
+ return this.$t(
119
+ 'windward.core.shared.settings.errors.input_limitations',
120
+ [255]
121
+ )
122
+ } else {
123
+ return true
124
+ }
125
+ },
120
126
  ],
121
127
  },
122
128
  }
@@ -28,9 +28,6 @@ export default {
28
28
  if (_.isEmpty(this.block.metadata.config)) {
29
29
  this.block.metadata.config = {}
30
30
  }
31
- if (_.isEmpty(this.block.metadata.config)) {
32
- this.block.metadata.config = {}
33
- }
34
31
  if (!_.isBoolean(this.block.metadata.config.dashed)) {
35
32
  this.block.metadata.config.dashed = false
36
33
  }
@@ -205,6 +205,7 @@ import BaseContentSettings from '~/components/Content/Settings/BaseContentSettin
205
205
  import TextEditor from '~/components/Text/TextEditor'
206
206
  import SortableExpansionPanel from '~/components/Core/SortableExpansionPanel.vue'
207
207
  import DialogBox from '~/components/Core/DialogBox.vue'
208
+ import Uuid from '~/helpers/Uuid'
208
209
 
209
210
  export default {
210
211
  name: 'ScenarioChoiceSettings',
@@ -250,20 +251,28 @@ export default {
250
251
  ],
251
252
  validation: {
252
253
  shortInputRules: [
253
- (v) =>
254
- v.length <= 50 ||
255
- this.$t(
256
- 'windward.core.shared.settings.errors.input_limitations',
257
- [50]
258
- ),
254
+ (v) => {
255
+ if (v && v.length >= 50) {
256
+ return this.$t(
257
+ 'windward.core.shared.settings.errors.input_limitations',
258
+ [50]
259
+ )
260
+ } else {
261
+ return true
262
+ }
263
+ },
259
264
  ],
260
265
  instructionRule: [
261
- (v) =>
262
- v.length <= 255 ||
263
- this.$t(
264
- 'windward.core.shared.settings.errors.input_limitations',
265
- [255]
266
- ),
266
+ (v) => {
267
+ if (v && v.length >= 255) {
268
+ return this.$t(
269
+ 'windward.core.shared.settings.errors.input_limitations',
270
+ [255]
271
+ )
272
+ } else {
273
+ return true
274
+ }
275
+ },
267
276
  ],
268
277
  },
269
278
  }
@@ -286,8 +295,14 @@ export default {
286
295
  if (_.isEmpty(this.block.metadata.config.title)) {
287
296
  this.block.metadata.config.title = ''
288
297
  }
289
- if (_.isEmpty(this.block.metadata.config.description)) {
290
- this.block.metadata.config.description = ''
298
+ if (
299
+ _.isEmpty(this.block.metadata.config.description) &&
300
+ this.block.id &&
301
+ !Uuid.test(this.block.id)
302
+ ) {
303
+ this.block.metadata.config.description = this.$t(
304
+ 'windward.core.components.content.blocks.scenario_choice.information'
305
+ )
291
306
  }
292
307
  if (_.isEmpty(this.block.metadata.config.display_style)) {
293
308
  this.block.metadata.config.display_style = 'letter'
@@ -1,78 +1,92 @@
1
1
  <template>
2
2
  <div>
3
- <v-divider class="my-4 primary"></v-divider>
4
- <p>{{ $t('windward.core.components.settings.tab.tabs') }}</p>
5
- <SortableExpansionPanel
6
- v-model="block.metadata.config.items"
7
- v-bind:currentPanel.sync="block.metadata.config.currentTab"
3
+ <v-row class="pl-3 pr-3">
4
+ <v-text-field
5
+ v-model="block.metadata.config.title"
6
+ :autofocus="true"
7
+ :rules="validation.shortInputRules"
8
+ :counter="50"
9
+ outlined
10
+ id="title"
11
+ :label="
12
+ $t('windward.core.components.settings.clickable_icon.title')
13
+ "
8
14
  :disabled="render"
9
- @change="onDragged"
10
- @click:close="onRemoveElement($event)"
11
- >
12
- <template #header="{ item }">
13
- {{ item.tabHeader !== '' ? item.tabHeader : 'No Header' }}
14
- </template>
15
- <template #body="{ item, index }">
16
- <v-container :key="expansionPanelKey">
17
- <p class="p-label">
18
- {{
19
- $t(
20
- 'windward.core.components.settings.tab.header'
21
- )
22
- }}
23
- </p>
24
- <v-text-field
25
- outlined
26
- :autofocus="true"
27
- v-model="
28
- block.metadata.config.items[index].tabHeader
29
- "
30
- :counter="50"
31
- :rules="validation.headerRule"
32
- :label="'item ' + (index + 1)"
33
- :disabled="render"
34
- ></v-text-field>
35
- <v-btn
36
- @click="onToggleExpand(index)"
37
- text
38
- elevation="0"
39
- class="mb-3"
40
- :disabled="render"
15
+ ></v-text-field>
16
+ <v-textarea
17
+ v-model="block.metadata.config.instructions"
18
+ :rules="validation.instructionRule"
19
+ :counter="255"
20
+ outlined
21
+ :label="$t('components.content.settings.base.instructions')"
22
+ :disabled="render"
23
+ ></v-textarea>
24
+ </v-row>
25
+ <v-divider class="my-4 primary"></v-divider>
26
+ <p>{{ $t('windward.core.components.settings.tab.tabs') }}</p>
27
+ <SortableExpansionPanel
28
+ v-model="block.metadata.config.items"
29
+ v-bind:currentPanel.sync="block.metadata.config.currentTab"
30
+ :disabled="render"
31
+ @change="onDragged"
32
+ @click:close="onRemoveElement($event)"
33
+ >
34
+ <template #header="{ item }">
35
+ {{ item.tabHeader !== '' ? item.tabHeader : 'No Header' }}
36
+ </template>
37
+ <template #body="{ item, index }">
38
+ <v-container :key="expansionPanelKey">
39
+ <p class="p-label">
40
+ {{ $t('windward.core.components.settings.tab.header') }}
41
+ </p>
42
+ <v-text-field
43
+ outlined
44
+ :autofocus="true"
45
+ v-model="block.metadata.config.items[index].tabHeader"
46
+ :counter="50"
47
+ :rules="validation.shortInputRules"
48
+ :label="'item ' + (index + 1)"
49
+ :disabled="render"
50
+ ></v-text-field>
51
+ <v-btn
52
+ @click="onToggleExpand(index)"
53
+ text
54
+ elevation="0"
55
+ class="mb-3"
56
+ :disabled="render"
57
+ >
58
+ <v-icon
59
+ v-if="!block.metadata.config.items[index].expand"
60
+ color="primary"
61
+ >mdi-arrow-expand-all</v-icon
62
+ >
63
+ <v-icon
64
+ v-if="block.metadata.config.items[index].expand"
65
+ color="primary"
41
66
  >
42
- <v-icon
43
- v-if="
44
- !block.metadata.config.items[index].expand
45
- "
46
- color="primary"
47
- >mdi-arrow-expand-all</v-icon
48
- >
49
- <v-icon
50
- v-if="block.metadata.config.items[index].expand"
51
- color="primary"
52
- >
53
- mdi-arrow-collapse-all
54
- </v-icon>
55
- </v-btn>
56
- <TextEditor
57
- v-model="block.metadata.config.items[index].content"
58
- v-if="!item.expand"
59
- :key="textEditorUpdateKey"
60
- :disabled="render"
61
- ></TextEditor>
62
- </v-container>
63
- </template>
64
- </SortableExpansionPanel>
65
- <v-row justify="center" class="my-4">
66
- <v-btn
67
- color="primary"
68
- elevation="0"
69
- :disabled="render"
70
- @click="onAddElement"
71
- >
72
- <v-icon>mdi-plus</v-icon>
73
- {{ $t('windward.core.components.settings.tab.add_tab') }}
74
- </v-btn>
75
- </v-row>
67
+ mdi-arrow-collapse-all
68
+ </v-icon>
69
+ </v-btn>
70
+ <TextEditor
71
+ v-model="block.metadata.config.items[index].content"
72
+ v-if="!item.expand"
73
+ :key="textEditorUpdateKey"
74
+ :disabled="render"
75
+ ></TextEditor>
76
+ </v-container>
77
+ </template>
78
+ </SortableExpansionPanel>
79
+ <v-row justify="center" class="my-4">
80
+ <v-btn
81
+ color="primary"
82
+ elevation="0"
83
+ :disabled="render"
84
+ @click="onAddElement"
85
+ >
86
+ <v-icon>mdi-plus</v-icon>
87
+ {{ $t('windward.core.components.settings.tab.add_tab') }}
88
+ </v-btn>
89
+ </v-row>
76
90
  <div v-if="loading" class="text-center">
77
91
  <v-progress-circular
78
92
  :size="70"
@@ -90,6 +104,7 @@ import Crypto from '~/helpers/Crypto'
90
104
  import TextEditor from '~/components/Text/TextEditor'
91
105
  import BaseContentSettings from '~/components/Content/Settings/BaseContentSettings.js'
92
106
  import SortableExpansionPanel from '~/components/Core/SortableExpansionPanel.vue'
107
+ import Uuid from '~/helpers/Uuid'
93
108
 
94
109
  export default {
95
110
  name: 'TabSettings',
@@ -110,6 +125,18 @@ export default {
110
125
  if (_.isEmpty(this.block.metadata.config)) {
111
126
  this.block.metadata.config = {}
112
127
  }
128
+ if (_.isEmpty(this.block.metadata.config.title)) {
129
+ this.block.metadata.config.title = ''
130
+ }
131
+ if (
132
+ _.isEmpty(this.block.metadata.config.instructions) &&
133
+ this.block.id &&
134
+ !Uuid.test(this.block.id)
135
+ ) {
136
+ this.block.metadata.config.instructions = this.$t(
137
+ 'windward.core.components.settings.tab.instructions'
138
+ )
139
+ }
113
140
  if (_.isEmpty(this.block.metadata.config.currentTab)) {
114
141
  this.block.metadata.config.currentTab = 0
115
142
  }
@@ -130,13 +157,29 @@ export default {
130
157
  valid: true,
131
158
  loading: false,
132
159
  validation: {
133
- headerRule: [
134
- (v) =>
135
- v.length <= 50 ||
136
- this.$t(
137
- 'windward.core.shared.settings.errors.input_limitations',
138
- [50]
139
- ),
160
+ shortInputRules: [
161
+ (v) => {
162
+ if (v && v.length >= 50) {
163
+ return this.$t(
164
+ 'windward.core.shared.settings.errors.input_limitations',
165
+ [50]
166
+ )
167
+ } else {
168
+ return true
169
+ }
170
+ },
171
+ ],
172
+ instructionRule: [
173
+ (v) => {
174
+ if (v && v.length >= 255) {
175
+ return this.$t(
176
+ 'windward.core.shared.settings.errors.input_limitations',
177
+ [255]
178
+ )
179
+ } else {
180
+ return true
181
+ }
182
+ },
140
183
  ],
141
184
  },
142
185
  }
@@ -6,23 +6,9 @@
6
6
  :rules="validation.titleRules"
7
7
  :counter="50"
8
8
  :autofocus="true"
9
- :label="$t('components.content.settings.base.title_optional')"
9
+ :label="$t('components.content.settings.base.title')"
10
10
  :disabled="render"
11
11
  ></v-text-field>
12
- <v-btn
13
- elevation="0"
14
- text
15
- class="mb-4"
16
- :disabled="render"
17
- @click="block.__expandInstructions = !block.__expandInstructions"
18
- >
19
- <v-icon v-if="!block.__expandInstructions" color="primary"
20
- >mdi-arrow-expand-all</v-icon
21
- >
22
- <v-icon v-if="block.__expandInstructions" color="primary">
23
- mdi-arrow-collapse-all
24
- </v-icon>
25
- </v-btn>
26
12
  <v-textarea
27
13
  v-model="block.metadata.config.instructions"
28
14
  :rules="validation.instructionRule"
@@ -60,6 +46,7 @@ import BaseContentSettings from '~/components/Content/Settings/BaseContentSettin
60
46
  import Crypto from '~/helpers/Crypto'
61
47
  import TextEditor from '~/components/Text/TextEditor'
62
48
  import _ from 'lodash'
49
+ import Uuid from '~/helpers/Uuid'
63
50
 
64
51
  export default {
65
52
  name: 'UserUploadSettings',
@@ -70,9 +57,6 @@ export default {
70
57
  this.block = {}
71
58
  }
72
59
 
73
- // Default the instructions to collapsed
74
- this.block.__expandInstructions = false
75
-
76
60
  if (_.isEmpty(this.block.body)) {
77
61
  this.block.body = this.$t(
78
62
  'windward.core.shared.content_blocks.title.user_upload'
@@ -87,8 +71,14 @@ export default {
87
71
  if (_.isEmpty(this.block.metadata.config.title)) {
88
72
  this.block.metadata.config.title = ''
89
73
  }
90
- if (_.isEmpty(this.block.metadata.config.title)) {
91
- this.block.metadata.config.instructions = ''
74
+ if (
75
+ _.isEmpty(this.block.metadata.config.instructions) &&
76
+ this.block.id &&
77
+ !Uuid.test(this.block.id)
78
+ ) {
79
+ this.block.metadata.config.instructions = this.$t(
80
+ 'windward.core.components.settings.user_upload.instructions'
81
+ )
92
82
  }
93
83
  if (_.isEmpty(this.block.metadata.config.uploadSettings)) {
94
84
  this.block.metadata.config.uploadSettings = {
@@ -141,20 +131,28 @@ export default {
141
131
  },
142
132
  validation: {
143
133
  titleRules: [
144
- (v) =>
145
- v.length <= 50 ||
146
- this.$t(
147
- 'windward.core.shared.settings.errors.input_limitations',
148
- [50]
149
- ),
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
+ },
150
144
  ],
151
145
  instructionRule: [
152
- (v) =>
153
- v.length <= 255 ||
154
- this.$t(
155
- 'windward.core.shared.settings.errors.input_limitations',
156
- [255]
157
- ),
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
+ },
158
156
  ],
159
157
  },
160
158
  }