@windward/core 0.4.2 → 0.5.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 (160) hide show
  1. package/.idea/codeStyles/Project.xml +58 -0
  2. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  3. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  4. package/.idea/modules.xml +8 -0
  5. package/.idea/php-docker-settings.xml +24 -0
  6. package/.idea/php.xml +19 -0
  7. package/.idea/vcs.xml +6 -0
  8. package/.idea/watcherTasks.xml +4 -0
  9. package/.idea/windward-ui-plugin-core.iml +8 -0
  10. package/bitbucket-pipelines.yml +14 -0
  11. package/components/Content/Blocks/Accordion.vue +10 -6
  12. package/components/Content/Blocks/ClickableIcons.vue +6 -5
  13. package/components/Content/Blocks/Feedback.vue +1 -1
  14. package/components/Content/Blocks/FileDownload/FileLinks.vue +82 -0
  15. package/components/Content/Blocks/FileDownload/FileTable.vue +106 -0
  16. package/components/Content/Blocks/FileDownload.vue +145 -0
  17. package/components/Content/Blocks/GenerateAIQuestionButton.vue +61 -0
  18. package/components/Content/Blocks/ScenarioChoice.vue +2 -2
  19. package/components/Content/Blocks/UserUpload.vue +15 -36
  20. package/components/Content/Blocks/Video.vue +2 -57
  21. package/components/Settings/AccordionSettings.vue +3 -6
  22. package/components/Settings/BlockQuoteSettings.vue +2 -2
  23. package/components/Settings/EmailSettings.vue +2 -2
  24. package/components/Settings/FileDownloadSettings.vue +168 -0
  25. package/components/Settings/UserUploadSettings.vue +36 -39
  26. package/components/utils/ContentViewer.vue +1 -0
  27. package/components/utils/TinyMCEWrapper.vue +18 -7
  28. package/components/utils/assets/tinymce/content/global.scss +10 -0
  29. package/config/menu.config.json +475 -0
  30. package/coverage/clover.xml +223 -0
  31. package/coverage/coverage-final.json +16 -0
  32. package/coverage/lcov-report/base.css +224 -0
  33. package/coverage/lcov-report/block-navigation.js +87 -0
  34. package/coverage/lcov-report/components/Content/Blocks/Accordion.vue.html +430 -0
  35. package/coverage/lcov-report/components/Content/Blocks/Image.vue.html +394 -0
  36. package/coverage/lcov-report/components/Content/Blocks/Math.vue.html +262 -0
  37. package/coverage/lcov-report/components/Content/Blocks/RichText.vue.html +295 -0
  38. package/coverage/lcov-report/components/Content/Blocks/Tab.vue.html +415 -0
  39. package/coverage/lcov-report/components/Content/Blocks/Table.vue.html +667 -0
  40. package/coverage/lcov-report/components/Content/Blocks/Video.vue.html +2275 -0
  41. package/coverage/lcov-report/components/Content/Blocks/index.html +206 -0
  42. package/coverage/lcov-report/components/utils/ContentViewer.vue.html +199 -0
  43. package/coverage/lcov-report/components/utils/MathExpressionEditor.vue.html +919 -0
  44. package/coverage/lcov-report/components/utils/MathLiveWrapper.vue.html +343 -0
  45. package/coverage/lcov-report/components/utils/TinyMCEWrapper.vue.html +271 -0
  46. package/coverage/lcov-report/components/utils/index.html +161 -0
  47. package/coverage/lcov-report/config/index.html +116 -0
  48. package/coverage/lcov-report/config/tinymce.config.js.html +493 -0
  49. package/coverage/lcov-report/favicon.png +0 -0
  50. package/coverage/lcov-report/helpers/MathHelper.ts.html +793 -0
  51. package/coverage/lcov-report/helpers/index.html +116 -0
  52. package/coverage/lcov-report/helpers/tinymce/index.html +116 -0
  53. package/coverage/lcov-report/helpers/tinymce/plugin.ts.html +334 -0
  54. package/coverage/lcov-report/index.html +191 -0
  55. package/coverage/lcov-report/prettify.css +1 -0
  56. package/coverage/lcov-report/prettify.js +2 -0
  57. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  58. package/coverage/lcov-report/sorter.js +196 -0
  59. package/coverage/lcov-report/test/index.html +116 -0
  60. package/coverage/lcov-report/test/mocks.js.html +457 -0
  61. package/coverage/lcov.info +403 -0
  62. package/i18n/en-US/components/content/blocks/file_download.ts +5 -0
  63. package/i18n/en-US/components/content/blocks/generate_questions.ts +3 -0
  64. package/i18n/en-US/components/content/blocks/index.ts +4 -0
  65. package/i18n/en-US/components/content/blocks/user_upload.ts +0 -2
  66. package/i18n/en-US/components/settings/file_download.ts +8 -0
  67. package/i18n/en-US/components/settings/index.ts +2 -0
  68. package/i18n/en-US/shared/content_blocks.ts +1 -0
  69. package/i18n/en-US/shared/settings.ts +1 -3
  70. package/i18n/es-ES/components/content/blocks/file_download.ts +5 -0
  71. package/i18n/es-ES/components/content/blocks/generate_questions.ts +3 -0
  72. package/i18n/es-ES/components/content/blocks/index.ts +6 -2
  73. package/i18n/es-ES/components/content/blocks/user_upload.ts +0 -2
  74. package/i18n/es-ES/components/settings/file_download.ts +8 -0
  75. package/i18n/es-ES/components/settings/index.ts +4 -2
  76. package/i18n/es-ES/shared/content_blocks.ts +1 -0
  77. package/i18n/es-ES/shared/settings.ts +1 -3
  78. package/i18n/sv-SE/components/content/blocks/file_download.ts +5 -0
  79. package/i18n/sv-SE/components/content/blocks/generate_questions.ts +3 -0
  80. package/i18n/sv-SE/components/content/blocks/index.ts +4 -0
  81. package/i18n/sv-SE/components/content/blocks/user_upload.ts +0 -2
  82. package/i18n/sv-SE/components/settings/file_download.ts +8 -0
  83. package/i18n/sv-SE/components/settings/index.ts +4 -2
  84. package/i18n/sv-SE/shared/content_blocks.ts +1 -0
  85. package/i18n/sv-SE/shared/settings.ts +2 -4
  86. package/lib/helpers/GlossaryHelper.d.ts +9 -0
  87. package/lib/helpers/GlossaryHelper.js +118 -0
  88. package/lib/helpers/GlossaryTerm.d.ts +10 -0
  89. package/lib/helpers/GlossaryTerm.js +22 -0
  90. package/lib/helpers/MathHelper.d.ts +99 -0
  91. package/lib/helpers/MathHelper.js +194 -0
  92. package/lib/helpers/tinymce/plugin.d.ts +2 -0
  93. package/lib/helpers/tinymce/plugin.js +86 -0
  94. package/lib/i18n/en-US/components/content/blocks/image.d.ts +6 -0
  95. package/lib/i18n/en-US/components/content/blocks/image.js +7 -0
  96. package/lib/i18n/en-US/components/content/blocks/index.d.ts +75 -0
  97. package/lib/i18n/en-US/components/content/blocks/index.js +14 -0
  98. package/lib/i18n/en-US/components/content/blocks/tab.d.ts +5 -0
  99. package/lib/i18n/en-US/components/content/blocks/tab.js +6 -0
  100. package/lib/i18n/en-US/components/content/blocks/table.d.ts +5 -0
  101. package/lib/i18n/en-US/components/content/blocks/table.js +6 -0
  102. package/lib/i18n/en-US/components/content/blocks/user_upload.d.ts +13 -0
  103. package/lib/i18n/en-US/components/content/blocks/user_upload.js +14 -0
  104. package/lib/i18n/en-US/components/content/blocks/video.d.ts +48 -0
  105. package/lib/i18n/en-US/components/content/blocks/video.js +49 -0
  106. package/lib/i18n/en-US/components/content/index.d.ts +77 -0
  107. package/lib/i18n/en-US/components/content/index.js +6 -0
  108. package/lib/i18n/en-US/components/index.d.ts +140 -0
  109. package/lib/i18n/en-US/components/index.js +12 -0
  110. package/lib/i18n/en-US/components/navigation/image.d.ts +5 -0
  111. package/lib/i18n/en-US/components/navigation/image.js +6 -0
  112. package/lib/i18n/en-US/components/navigation/index.d.ts +10 -0
  113. package/lib/i18n/en-US/components/navigation/index.js +8 -0
  114. package/lib/i18n/en-US/components/navigation/user_upload.d.ts +4 -0
  115. package/lib/i18n/en-US/components/navigation/user_upload.js +5 -0
  116. package/lib/i18n/en-US/components/settings/clickable_icon.d.ts +6 -0
  117. package/lib/i18n/en-US/components/settings/clickable_icon.js +7 -0
  118. package/lib/i18n/en-US/components/settings/image.d.ts +2 -0
  119. package/lib/i18n/en-US/components/settings/image.js +3 -0
  120. package/lib/i18n/en-US/components/settings/index.d.ts +39 -0
  121. package/lib/i18n/en-US/components/settings/index.js +14 -0
  122. package/lib/i18n/en-US/components/settings/text_editor.d.ts +8 -0
  123. package/lib/i18n/en-US/components/settings/text_editor.js +9 -0
  124. package/lib/i18n/en-US/components/settings/user_upload.d.ts +12 -0
  125. package/lib/i18n/en-US/components/settings/user_upload.js +13 -0
  126. package/lib/i18n/en-US/components/settings/video.d.ts +13 -0
  127. package/lib/i18n/en-US/components/settings/video.js +14 -0
  128. package/lib/i18n/en-US/components/utils/index.d.ts +15 -0
  129. package/lib/i18n/en-US/components/utils/index.js +6 -0
  130. package/lib/i18n/en-US/components/utils/tiny_mce_wrapper.d.ts +13 -0
  131. package/lib/i18n/en-US/components/utils/tiny_mce_wrapper.js +14 -0
  132. package/lib/i18n/en-US/index.d.ts +197 -0
  133. package/lib/i18n/en-US/index.js +16 -0
  134. package/lib/i18n/en-US/modules/index.d.ts +2 -0
  135. package/lib/i18n/en-US/modules/index.js +6 -0
  136. package/lib/i18n/en-US/pages/glossary.d.ts +8 -0
  137. package/lib/i18n/en-US/pages/glossary.js +9 -0
  138. package/lib/i18n/en-US/pages/index.d.ts +13 -0
  139. package/lib/i18n/en-US/pages/index.js +8 -0
  140. package/lib/i18n/en-US/pages/user_upload.d.ts +4 -0
  141. package/lib/i18n/en-US/pages/user_upload.js +5 -0
  142. package/lib/i18n/en-US/shared/content_blocks.d.ts +20 -0
  143. package/lib/i18n/en-US/shared/content_blocks.js +21 -0
  144. package/lib/i18n/en-US/shared/index.d.ts +39 -0
  145. package/lib/i18n/en-US/shared/index.js +10 -0
  146. package/lib/i18n/en-US/shared/menu.d.ts +4 -0
  147. package/lib/i18n/en-US/shared/menu.js +5 -0
  148. package/lib/i18n/en-US/shared/settings.d.ts +15 -0
  149. package/lib/i18n/en-US/shared/settings.js +16 -0
  150. package/lib/i18n/en-US.d.ts +197 -0
  151. package/lib/i18n/en-US.js +15 -0
  152. package/lib/models/UserFileAsset.d.ts +5 -0
  153. package/lib/models/UserFileAsset.js +37 -0
  154. package/package.json +2 -2
  155. package/plugin.js +20 -0
  156. package/test/Components/Content/Blocks/FileDownload.spec.js +25 -0
  157. package/test/Components/Content/Blocks/Video.spec.js +0 -22
  158. package/test/Components/Settings/FileDownloadSettings.spec.js +20 -0
  159. package/test/Components/Settings/UserUploadSettings.spec.js +1 -1
  160. package/utils/index.js +2 -0
@@ -0,0 +1,58 @@
1
+ <component name="ProjectCodeStyleConfiguration">
2
+ <code_scheme name="Project" version="173">
3
+ <HTMLCodeStyleSettings>
4
+ <option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
5
+ <option name="HTML_ENFORCE_QUOTES" value="true" />
6
+ </HTMLCodeStyleSettings>
7
+ <JSCodeStyleSettings version="0">
8
+ <option name="FORCE_SEMICOLON_STYLE" value="true" />
9
+ <option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
10
+ <option name="FORCE_QUOTE_STYlE" value="true" />
11
+ <option name="ENFORCE_TRAILING_COMMA" value="Remove" />
12
+ <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
13
+ <option name="SPACES_WITHIN_IMPORTS" value="true" />
14
+ </JSCodeStyleSettings>
15
+ <TypeScriptCodeStyleSettings version="0">
16
+ <option name="FORCE_SEMICOLON_STYLE" value="true" />
17
+ <option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
18
+ <option name="FORCE_QUOTE_STYlE" value="true" />
19
+ <option name="ENFORCE_TRAILING_COMMA" value="Remove" />
20
+ <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
21
+ <option name="SPACES_WITHIN_IMPORTS" value="true" />
22
+ </TypeScriptCodeStyleSettings>
23
+ <VueCodeStyleSettings>
24
+ <option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
25
+ <option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
26
+ </VueCodeStyleSettings>
27
+ <codeStyleSettings language="HTML">
28
+ <option name="SOFT_MARGINS" value="80" />
29
+ <indentOptions>
30
+ <option name="INDENT_SIZE" value="2" />
31
+ <option name="CONTINUATION_INDENT_SIZE" value="2" />
32
+ <option name="TAB_SIZE" value="2" />
33
+ </indentOptions>
34
+ </codeStyleSettings>
35
+ <codeStyleSettings language="JavaScript">
36
+ <option name="SOFT_MARGINS" value="80" />
37
+ <indentOptions>
38
+ <option name="INDENT_SIZE" value="2" />
39
+ <option name="CONTINUATION_INDENT_SIZE" value="2" />
40
+ <option name="TAB_SIZE" value="2" />
41
+ </indentOptions>
42
+ </codeStyleSettings>
43
+ <codeStyleSettings language="TypeScript">
44
+ <option name="SOFT_MARGINS" value="80" />
45
+ <indentOptions>
46
+ <option name="INDENT_SIZE" value="2" />
47
+ <option name="CONTINUATION_INDENT_SIZE" value="2" />
48
+ <option name="TAB_SIZE" value="2" />
49
+ </indentOptions>
50
+ </codeStyleSettings>
51
+ <codeStyleSettings language="Vue">
52
+ <option name="SOFT_MARGINS" value="80" />
53
+ <indentOptions>
54
+ <option name="CONTINUATION_INDENT_SIZE" value="2" />
55
+ </indentOptions>
56
+ </codeStyleSettings>
57
+ </code_scheme>
58
+ </component>
@@ -0,0 +1,5 @@
1
+ <component name="ProjectCodeStyleConfiguration">
2
+ <state>
3
+ <option name="USE_PER_PROJECT_SETTINGS" value="true" />
4
+ </state>
5
+ </component>
@@ -0,0 +1,6 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
+ </profile>
6
+ </component>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/windward-ui-plugin-core.iml" filepath="$PROJECT_DIR$/.idea/windward-ui-plugin-core.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="PhpDockerContainerSettings">
4
+ <list>
5
+ <map>
6
+ <entry key="79d59a8f-c56c-4789-b96c-e55a326ab125">
7
+ <value>
8
+ <DockerContainerSettings>
9
+ <option name="version" value="1" />
10
+ <option name="volumeBindings">
11
+ <list>
12
+ <DockerVolumeBindingImpl>
13
+ <option name="containerPath" value="/opt/project" />
14
+ <option name="hostPath" value="$PROJECT_DIR$" />
15
+ </DockerVolumeBindingImpl>
16
+ </list>
17
+ </option>
18
+ </DockerContainerSettings>
19
+ </value>
20
+ </entry>
21
+ </map>
22
+ </list>
23
+ </component>
24
+ </project>
package/.idea/php.xml ADDED
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="MessDetectorOptionsConfiguration">
4
+ <option name="transferred" value="true" />
5
+ </component>
6
+ <component name="PHPCSFixerOptionsConfiguration">
7
+ <option name="transferred" value="true" />
8
+ </component>
9
+ <component name="PHPCodeSnifferOptionsConfiguration">
10
+ <option name="highlightLevel" value="WARNING" />
11
+ <option name="transferred" value="true" />
12
+ </component>
13
+ <component name="PhpStanOptionsConfiguration">
14
+ <option name="transferred" value="true" />
15
+ </component>
16
+ <component name="PsalmOptionsConfiguration">
17
+ <option name="transferred" value="true" />
18
+ </component>
19
+ </project>
package/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectTasksOptions" suppressed-tasks="SCSS" />
4
+ </project>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="WEB_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$" />
5
+ <orderEntry type="inheritedJdk" />
6
+ <orderEntry type="sourceFolder" forTests="false" />
7
+ </component>
8
+ </module>
@@ -0,0 +1,14 @@
1
+ image: atlassian/default-image:3
2
+
3
+ pipelines:
4
+ custom:
5
+ create-release:
6
+ import: infrastructure-automation:master:create-release
7
+ publish-release:
8
+ import: infrastructure-automation:master:publish-release
9
+
10
+ branches:
11
+ "release/*":
12
+ import: infrastructure-automation:master:auto-update
13
+ "hotfix/*":
14
+ import: infrastructure-automation:master:auto-update
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div>
3
3
  <v-expansion-panels
4
- v-model="selectedPanels"
4
+ :value="selectedPanels"
5
5
  flat
6
6
  accordion
7
7
  focusable
@@ -101,9 +101,6 @@ export default {
101
101
  this.block.metadata.config.items = []
102
102
  this.block.metadata.config.items.push(defaultObject)
103
103
  }
104
- if (_.isEmpty(this.block.metadata.config.selectedPanels)) {
105
- this.block.metadata.config.selectedPanels = 0
106
- }
107
104
  this.block.body = this.$t(
108
105
  'windward.core.shared.content_blocks.title.accordion'
109
106
  )
@@ -112,7 +109,7 @@ export default {
112
109
  return {
113
110
  expansionPanelKey: '0',
114
111
  editingInContentItem: false,
115
- selectedPanels: 0,
112
+ selectedPanels: null,
116
113
  }
117
114
  },
118
115
  watch: {
@@ -125,6 +122,7 @@ export default {
125
122
  this.selectedPanels = newValue.metadata.config.selectedPanels
126
123
  this.expansionPanelKey = Crypto.id()
127
124
  }
125
+
128
126
  const length = newValue.metadata.config.items.length
129
127
  let counter = 0
130
128
  newValue.metadata.config.items.forEach((element) => {
@@ -148,10 +146,16 @@ export default {
148
146
  this.block.metadata.config.items.forEach((element) => {
149
147
  element.expand = false
150
148
  })
151
- this.selectedPanels = 0
149
+ this.selectedPanels = null
152
150
  }
153
151
  },
154
152
  },
153
+ mounted() {
154
+ if (this.render) {
155
+ // ensure panels are always loaded closed
156
+ this.selectedPanels = null
157
+ }
158
+ },
155
159
  methods: {
156
160
  getImagePublicUrl(asset) {
157
161
  const foundAsset = this.resolveAsset(asset)
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div>
3
- <v-container>
3
+ <v-container class="pa-0">
4
4
  <h2>{{ block.metadata.config.title }}</h2>
5
5
 
6
6
  <h4>{{ block.metadata.config.description }}</h4>
@@ -13,14 +13,15 @@
13
13
  }}
14
14
  </p>
15
15
  </v-container>
16
- <v-container>
16
+ <v-container class="pa-0">
17
17
  <v-row
18
18
  v-for="(item, itemIndex) in block.metadata.config.items"
19
19
  :key="itemIndex"
20
20
  no-gutters
21
21
  :class="rowClass(itemIndex)"
22
+ class="pa-0"
22
23
  >
23
- <v-col cols="12" v-bind="iconColumnAttrs" class="pa-4">
24
+ <v-col cols="12" v-bind="iconColumnAttrs">
24
25
  <button
25
26
  :class="activatorButtonClass(itemIndex)"
26
27
  @click="item.active = !item.active"
@@ -144,14 +145,14 @@ export default {
144
145
  if (this.block.metadata.config.display.large_icon) {
145
146
  return {
146
147
  xl: '3',
147
- lg: '4',
148
+ lg: '3',
148
149
  md: '4',
149
150
  sm: '4',
150
151
  }
151
152
  } else {
152
153
  return {
153
154
  xl: '2',
154
- lg: '3',
155
+ lg: '2',
155
156
  md: '3',
156
157
  sm: '3',
157
158
  }
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <v-container>
3
- <v-container v-if="!doesFeedbackExist">
3
+ <v-container v-if="!doesFeedbackExist" class="pa-0">
4
4
  <v-row>
5
5
  <h2>
6
6
  {{
@@ -0,0 +1,82 @@
1
+ <template>
2
+ <v-list>
3
+ <v-list-item
4
+ v-for="(item, index) in value"
5
+ :key="item.file.id + '-' + index"
6
+ :data-activator="'file-link-item-' + index"
7
+ class="pa-0"
8
+ dense
9
+ @click="onClickFile(item)"
10
+ >
11
+ <v-list-item-icon class="mx-3">
12
+ <v-icon>mdi-file-download</v-icon>
13
+ </v-list-item-icon>
14
+
15
+ <v-list-item-content class="text-link py-0"
16
+ >{{ filename(item) }}
17
+ </v-list-item-content>
18
+
19
+ <v-tooltip
20
+ left
21
+ eager
22
+ :activator="'[data-activator=file-link-item-' + index + ']'"
23
+ >
24
+ <span>{{ item.file.asset.metadata.size | humanFilesize }}</span>
25
+ </v-tooltip>
26
+ </v-list-item>
27
+ </v-list>
28
+ </template>
29
+
30
+ <script>
31
+ import _ from 'lodash'
32
+ import Download from '~/helpers/Download'
33
+
34
+ export default {
35
+ name: 'DisplayFileLinks',
36
+ components: {},
37
+ props: {
38
+ value: {
39
+ type: Array,
40
+ required: false,
41
+ default: () => {
42
+ return []
43
+ },
44
+ },
45
+ },
46
+ data() {
47
+ return {
48
+ Download,
49
+ }
50
+ },
51
+ computed: {
52
+ filename() {
53
+ return (item) => {
54
+ const extension = _.get(
55
+ item,
56
+ 'file.asset.metadata.extension',
57
+ ''
58
+ )
59
+ let filename = ''
60
+ // Resolve the filename from either the user defined or from the fileasset itself
61
+ if (item.name) {
62
+ // If we're defining a custom name make sure the file has the extension on it so users know what it is
63
+ filename = item.name
64
+ filename =
65
+ filename.replace(new RegExp(extension + '$'), '') +
66
+ '.' +
67
+ extension
68
+ } else {
69
+ filename = item.file.name || item.file.asset.name
70
+ }
71
+ return filename
72
+ }
73
+ },
74
+ },
75
+ mounted() {},
76
+ methods: {
77
+ onClickFile(item) {
78
+ Download.url(item.file.asset.public_url, this.filename(item))
79
+ },
80
+ },
81
+ }
82
+ </script>
@@ -0,0 +1,106 @@
1
+ <template>
2
+ <v-card>
3
+ <v-card-text>
4
+ <v-simple-table>
5
+ <template #default>
6
+ <thead>
7
+ <tr>
8
+ <th>
9
+ {{ $t('shared.file.name') }}
10
+ </th>
11
+ <th>
12
+ {{ $t('shared.file.size') }}
13
+ </th>
14
+ <th>
15
+ {{ $t('shared.file.download') }}
16
+ </th>
17
+ </tr>
18
+ </thead>
19
+ <tbody>
20
+ <tr
21
+ v-for="(item, index) in value"
22
+ :key="item.file.id + '-' + index"
23
+ >
24
+ <td>
25
+ {{ filename(item) }}
26
+ </td>
27
+ <td>
28
+ {{
29
+ item.file.asset.metadata.size
30
+ | humanFilesize
31
+ }}
32
+ </td>
33
+ <td>
34
+ <v-btn
35
+ link
36
+ elevation="0"
37
+ @click="
38
+ Download.url(
39
+ item.file.asset.public_url,
40
+ item.file.name
41
+ )
42
+ "
43
+ >
44
+ <v-icon>mdi-download</v-icon>
45
+ <span class="sr-only">
46
+ {{ $t('shared.file.download') }}
47
+ </span>
48
+ </v-btn>
49
+ </td>
50
+ </tr>
51
+ </tbody>
52
+ </template>
53
+ </v-simple-table>
54
+ </v-card-text>
55
+ </v-card>
56
+ </template>
57
+
58
+ <script>
59
+ import _ from 'lodash'
60
+ import Download from '~/helpers/Download'
61
+
62
+ export default {
63
+ name: 'DisplayFilesTable',
64
+ components: {},
65
+ props: {
66
+ value: {
67
+ type: Array,
68
+ required: false,
69
+ default: () => {
70
+ return []
71
+ },
72
+ },
73
+ },
74
+ data() {
75
+ return {
76
+ Download,
77
+ }
78
+ },
79
+ computed: {
80
+ filename() {
81
+ return (item) => {
82
+ const extension = _.get(
83
+ item,
84
+ 'file.asset.metadata.extension',
85
+ ''
86
+ )
87
+ let filename = ''
88
+ // Resolve the filename from either the user defined or from the fileasset itself
89
+ if (item.name) {
90
+ // If we're defining a custom name make sure the file has the extension on it so users know what it is
91
+ filename = item.name
92
+ filename =
93
+ filename.replace(new RegExp(extension + '$'), '') +
94
+ '.' +
95
+ extension
96
+ } else {
97
+ filename = item.file.name || item.file.asset.name
98
+ }
99
+ return filename
100
+ }
101
+ },
102
+ },
103
+ mounted() {},
104
+ methods: {},
105
+ }
106
+ </script>
@@ -0,0 +1,145 @@
1
+ <template>
2
+ <v-container>
3
+ <h2>
4
+ {{
5
+ block.metadata.config.title ||
6
+ $t(
7
+ 'windward.core.components.content.blocks.file_download.default_title'
8
+ )
9
+ }}
10
+ </h2>
11
+ <p v-if="!block.metadata.config.instructions">
12
+ {{
13
+ $t(
14
+ 'windward.core.components.content.blocks.file_download.default_instructions'
15
+ )
16
+ }}
17
+ </p>
18
+ <TextViewer
19
+ v-if="block.metadata.config.instructions"
20
+ :value="block.metadata.config.instructions"
21
+ />
22
+ <v-alert
23
+ v-if="
24
+ !block.metadata.config.items ||
25
+ block.metadata.config.items.length === 0
26
+ "
27
+ type="warning"
28
+ >
29
+ {{
30
+ $t(
31
+ 'windward.core.components.content.blocks.file_download.no_files'
32
+ )
33
+ }}
34
+ </v-alert>
35
+ <FileTable
36
+ v-if="
37
+ block.metadata.config.display_detailed &&
38
+ block.metadata.config.items &&
39
+ block.metadata.config.items.length !== 0
40
+ "
41
+ :value="resolvedItemAssets"
42
+ ></FileTable>
43
+ <FileLinks
44
+ v-if="
45
+ !block.metadata.config.display_detailed &&
46
+ block.metadata.config.items &&
47
+ block.metadata.config.items.length !== 0
48
+ "
49
+ :value="resolvedItemAssets"
50
+ ></FileLinks>
51
+ </v-container>
52
+ </template>
53
+
54
+ <script>
55
+ import _ from 'lodash'
56
+ import { mapGetters } from 'vuex'
57
+ import TextViewer from '~/components/Text/TextViewer'
58
+ import TextEditor from '~/components/Text/TextEditor'
59
+ import Download from '~/helpers/Download'
60
+
61
+ import BaseContentBlock from '~/components/Content/Blocks/BaseContentBlock'
62
+ import FileTable from './FileDownload/FileTable.vue'
63
+ import FileLinks from './FileDownload/FileLinks.vue'
64
+
65
+ export default {
66
+ name: 'FileDownloadBlock',
67
+ components: {
68
+ TextEditor,
69
+ TextViewer,
70
+ FileTable,
71
+ FileLinks,
72
+ },
73
+ extends: BaseContentBlock,
74
+ data() {
75
+ return {
76
+ Download,
77
+ saveState: false, // Override the base block to disable state saving
78
+ valid: true,
79
+ loading: false,
80
+ uploadFiles: [],
81
+ userFileAsset: {},
82
+ studentUpload: null,
83
+ maxFileLimit: 10,
84
+ }
85
+ },
86
+ computed: {
87
+ ...mapGetters({
88
+ enrollment: 'enrollment/get',
89
+ }),
90
+ resolvedItemAssets() {
91
+ const items = []
92
+ for (const index in this.block.metadata.config.items) {
93
+ // Skip items missing a file since we're probably adding a new one in the settings
94
+ if (_.isEmpty(this.block.metadata.config.items[index].file)) {
95
+ continue
96
+ }
97
+
98
+ const item = {
99
+ name: this.block.metadata.config.items[index].name,
100
+ file: this.resolveAsset(
101
+ this.block.metadata.config.items[index].file
102
+ ),
103
+ }
104
+ items.push(item)
105
+ }
106
+
107
+ return items
108
+ },
109
+ },
110
+ beforeMount() {
111
+ if (_.isEmpty(this.block)) {
112
+ this.block = {}
113
+ }
114
+ if (_.isEmpty(this.block.body)) {
115
+ this.block.body = this.$t(
116
+ 'windward.core.shared.content_blocks.title.file_download'
117
+ )
118
+ }
119
+ if (_.isEmpty(this.block.metadata)) {
120
+ this.block.metadata = {}
121
+ }
122
+ if (_.isEmpty(this.block.metadata.config)) {
123
+ this.block.metadata.config = {}
124
+ }
125
+ if (_.isEmpty(this.block.metadata.config.title)) {
126
+ this.block.metadata.config.title = this.$t(
127
+ 'windward.core.components.content.blocks.file_download.default_title'
128
+ )
129
+ }
130
+ if (_.isEmpty(this.block.metadata.config.instructions)) {
131
+ this.block.metadata.config.instructions = this.$t(
132
+ 'windward.core.components.content.blocks.file_download.default_instructions'
133
+ )
134
+ }
135
+ if (!_.isBoolean(this.block.metadata.config.display_detailed)) {
136
+ this.block.metadata.config.display_detailed = false
137
+ }
138
+ if (_.isEmpty(this.block.metadata.config.items)) {
139
+ this.block.metadata.config.items = []
140
+ }
141
+ },
142
+ mounted() {},
143
+ methods: {},
144
+ }
145
+ </script>
@@ -0,0 +1,61 @@
1
+ <template>
2
+ <v-btn
3
+ elevation="0"
4
+ color="primary"
5
+ icon
6
+ @click="generateAIQuestion"
7
+ :loading="isLoading"
8
+ :disabled="isLoading"
9
+ >
10
+ <v-icon v-if="!isLoading">mdi-magic-staff</v-icon>
11
+ <template v-slot:loader>
12
+ <v-progress-circular indeterminate size="23"></v-progress-circular>
13
+ </template>
14
+ </v-btn>
15
+ </template>
16
+
17
+ <script>
18
+ import AssessmentQuestion from '~/models/AssessmentQuestion'
19
+ import Course from '~/models/Course'
20
+ import Assessment from '~/models/Assessment'
21
+ import Content from '~/models/Content'
22
+
23
+ export default {
24
+ name: 'GenerateAIQuestionButton',
25
+ props: {
26
+ course: { type: Object, required: true },
27
+ content: { type: Object, required: true },
28
+ block: { type: Object, required: true },
29
+ questionType: { type: String, required: true },
30
+ },
31
+ data() {
32
+ return {
33
+ isLoading: false,
34
+ }
35
+ },
36
+ methods: {
37
+ async generateAIQuestion() {
38
+ this.isLoading = true
39
+ try {
40
+ const response = await AssessmentQuestion.custom(
41
+ new Course(this.course),
42
+ new Content(this.content),
43
+ new Assessment({ id: this.block.id }),
44
+ new AssessmentQuestion(),
45
+ `suggest/${this.questionType}`
46
+ ).get()
47
+
48
+ if (response && response.length > 0) {
49
+ const generatedQuestion = response[0]
50
+ this.$emit('click:generate', generatedQuestion)
51
+ }
52
+ } catch (error) {
53
+ console.error(error)
54
+ this.$dialog.error(this.$t('windward.core.components.content.blocks.generate_questions.error'))
55
+ } finally {
56
+ this.isLoading = false
57
+ }
58
+ },
59
+ },
60
+ }
61
+ </script>