@windward/core 0.0.8 → 0.1.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 (194) hide show
  1. package/components/Content/Blocks/BlockQuote.vue +191 -0
  2. package/components/Content/Blocks/ClickableIcons.vue +128 -40
  3. package/components/Content/Blocks/FeedbackTemplates/FeedbackQuestionLikert.vue +25 -14
  4. package/components/Content/Blocks/FeedbackTemplates/FeedbackQuestionTrueFalse.vue +3 -7
  5. package/components/Content/Blocks/Image.vue +2 -2
  6. package/components/Content/Blocks/OpenResponse.vue +20 -14
  7. package/components/Content/Blocks/ScenarioChoice.vue +262 -0
  8. package/components/Content/Blocks/Tab.vue +2 -7
  9. package/components/Settings/AccordionSettings.vue +97 -74
  10. package/components/Settings/BlockQuoteSettings.vue +143 -0
  11. package/components/Settings/ClickableIconsSettings.vue +101 -86
  12. package/components/Settings/OpenResponseSettings.vue +6 -8
  13. package/components/Settings/ScenarioChoiceSettings.vue +329 -0
  14. package/components/Settings/TabSettings.vue +79 -62
  15. package/components/Settings/TextEditorSettings.vue +1 -3
  16. package/components/utils/FillInBlank/FillInBlankInput.vue +4 -1
  17. package/components/utils/MathExpressionEditor.vue +30 -15
  18. package/components/utils/TinyMCEWrapper.vue +3 -1
  19. package/helpers/FillInBlankHelper.ts +0 -2
  20. package/i18n/en-US/components/content/blocks/block_quote.ts +3 -0
  21. package/i18n/en-US/components/content/blocks/index.ts +4 -2
  22. package/i18n/en-US/components/content/blocks/scenario_choice.ts +5 -0
  23. package/i18n/en-US/components/settings/accordion.ts +5 -0
  24. package/i18n/en-US/components/settings/block_quote.ts +9 -0
  25. package/i18n/en-US/components/settings/clickable_icon.ts +8 -0
  26. package/i18n/en-US/components/settings/index.ts +8 -0
  27. package/i18n/en-US/components/settings/scenario_choice.ts +19 -0
  28. package/i18n/en-US/components/settings/tab.ts +7 -0
  29. package/i18n/en-US/components/utils/FillInBlank/FillInBlankInput.ts +1 -1
  30. package/i18n/en-US/components/utils/index.ts +2 -0
  31. package/i18n/en-US/components/utils/math_expression_editor.ts +3 -0
  32. package/i18n/en-US/shared/content_blocks.ts +2 -0
  33. package/i18n/en-US/shared/settings.ts +4 -0
  34. package/i18n/es-ES/components/content/blocks/block_quote.ts +3 -0
  35. package/i18n/es-ES/components/content/blocks/feedback.ts +2 -0
  36. package/i18n/es-ES/components/content/blocks/index.ts +4 -2
  37. package/i18n/es-ES/components/content/blocks/scenario_choice.ts +6 -0
  38. package/i18n/es-ES/components/navigation/index.ts +2 -0
  39. package/i18n/es-ES/components/settings/accordion.ts +5 -0
  40. package/i18n/es-ES/components/settings/block_quote.ts +9 -0
  41. package/i18n/es-ES/components/settings/clickable_icon.ts +8 -0
  42. package/i18n/es-ES/components/settings/index.ts +8 -0
  43. package/i18n/es-ES/components/settings/scenario_choice.ts +19 -0
  44. package/i18n/es-ES/components/{content/blocks → settings}/tab.ts +3 -0
  45. package/i18n/es-ES/components/utils/FillInBlank/FillInBlankInput.ts +13 -0
  46. package/i18n/es-ES/components/utils/FillInBlank/FillInTheBlanksManager.ts +11 -0
  47. package/i18n/es-ES/components/utils/FillInBlank/index.ts +6 -0
  48. package/i18n/es-ES/components/utils/index.ts +4 -1
  49. package/i18n/es-ES/components/utils/math_expression_editor.ts +3 -0
  50. package/i18n/es-ES/components/utils/tiny_mce_wrapper.ts +1 -0
  51. package/i18n/es-ES/shared/content_blocks.ts +2 -0
  52. package/i18n/es-ES/shared/menu.ts +1 -0
  53. package/i18n/es-ES/shared/settings.ts +4 -0
  54. package/i18n/index.ts +11 -0
  55. package/i18n/sv-SE/components/content/blocks/block_quote.ts +3 -0
  56. package/i18n/sv-SE/components/content/blocks/feedback.ts +2 -0
  57. package/i18n/sv-SE/components/content/blocks/index.ts +4 -2
  58. package/i18n/sv-SE/components/content/blocks/scenario_choice.ts +5 -0
  59. package/i18n/sv-SE/components/navigation/index.ts +2 -0
  60. package/i18n/sv-SE/components/settings/accordion.ts +5 -0
  61. package/i18n/sv-SE/components/settings/block_quote.ts +9 -0
  62. package/i18n/sv-SE/components/settings/clickable_icon.ts +8 -0
  63. package/i18n/sv-SE/components/settings/index.ts +8 -0
  64. package/i18n/sv-SE/components/settings/scenario_choice.ts +19 -0
  65. package/i18n/sv-SE/components/{content/blocks → settings}/tab.ts +3 -0
  66. package/i18n/sv-SE/components/utils/FillInBlank/FillInBlankInput.ts +13 -0
  67. package/i18n/sv-SE/components/utils/FillInBlank/FillInTheBlanksManager.ts +11 -0
  68. package/i18n/sv-SE/components/utils/FillInBlank/index.ts +6 -0
  69. package/i18n/sv-SE/components/utils/index.ts +4 -1
  70. package/i18n/sv-SE/components/utils/math_expression_editor.ts +3 -0
  71. package/i18n/sv-SE/components/utils/tiny_mce_wrapper.ts +1 -0
  72. package/i18n/sv-SE/shared/content_blocks.ts +2 -0
  73. package/i18n/sv-SE/shared/menu.ts +1 -0
  74. package/i18n/sv-SE/shared/settings.ts +4 -0
  75. package/package.json +5 -4
  76. package/plugin.js +45 -5
  77. package/test/Components/Content/Blocks/BlockQuote.spec.js +21 -0
  78. package/test/Components/Content/Blocks/ScenarioChoice.spec.js +21 -0
  79. package/test/Components/Settings/BlockQuoteSettings.spec.js +20 -0
  80. package/test/Components/Settings/ClickableIconsSettings.spec.js +1 -1
  81. package/test/Components/Settings/ScenarioChoiceSettings.spec.js +20 -0
  82. package/test/Feature/LocaleKeys.spec.js +9 -0
  83. package/test/__mocks__/componentsMock.js +24 -0
  84. package/test/locales.js +95 -0
  85. package/.idea/codeStyles/Project.xml +0 -58
  86. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  87. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  88. package/.idea/modules.xml +0 -8
  89. package/.idea/php-docker-settings.xml +0 -24
  90. package/.idea/php.xml +0 -19
  91. package/.idea/vcs.xml +0 -6
  92. package/.idea/watcherTasks.xml +0 -4
  93. package/.idea/windward-ui-plugin-core.iml +0 -8
  94. package/coverage/clover.xml +0 -223
  95. package/coverage/coverage-final.json +0 -16
  96. package/coverage/lcov-report/base.css +0 -224
  97. package/coverage/lcov-report/block-navigation.js +0 -87
  98. package/coverage/lcov-report/components/Content/Blocks/Accordion.vue.html +0 -430
  99. package/coverage/lcov-report/components/Content/Blocks/Image.vue.html +0 -394
  100. package/coverage/lcov-report/components/Content/Blocks/Math.vue.html +0 -262
  101. package/coverage/lcov-report/components/Content/Blocks/RichText.vue.html +0 -295
  102. package/coverage/lcov-report/components/Content/Blocks/Tab.vue.html +0 -415
  103. package/coverage/lcov-report/components/Content/Blocks/Table.vue.html +0 -667
  104. package/coverage/lcov-report/components/Content/Blocks/Video.vue.html +0 -2275
  105. package/coverage/lcov-report/components/Content/Blocks/index.html +0 -206
  106. package/coverage/lcov-report/components/utils/ContentViewer.vue.html +0 -199
  107. package/coverage/lcov-report/components/utils/MathExpressionEditor.vue.html +0 -919
  108. package/coverage/lcov-report/components/utils/MathLiveWrapper.vue.html +0 -343
  109. package/coverage/lcov-report/components/utils/TinyMCEWrapper.vue.html +0 -271
  110. package/coverage/lcov-report/components/utils/index.html +0 -161
  111. package/coverage/lcov-report/config/index.html +0 -116
  112. package/coverage/lcov-report/config/tinymce.config.js.html +0 -493
  113. package/coverage/lcov-report/favicon.png +0 -0
  114. package/coverage/lcov-report/helpers/MathHelper.ts.html +0 -793
  115. package/coverage/lcov-report/helpers/index.html +0 -116
  116. package/coverage/lcov-report/helpers/tinymce/index.html +0 -116
  117. package/coverage/lcov-report/helpers/tinymce/plugin.ts.html +0 -334
  118. package/coverage/lcov-report/index.html +0 -191
  119. package/coverage/lcov-report/prettify.css +0 -1
  120. package/coverage/lcov-report/prettify.js +0 -2
  121. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  122. package/coverage/lcov-report/sorter.js +0 -196
  123. package/coverage/lcov-report/test/index.html +0 -116
  124. package/coverage/lcov-report/test/mocks.js.html +0 -457
  125. package/coverage/lcov.info +0 -403
  126. package/i18n/en-US/components/content/blocks/tab.ts +0 -4
  127. package/lib/helpers/GlossaryHelper.d.ts +0 -9
  128. package/lib/helpers/GlossaryHelper.js +0 -118
  129. package/lib/helpers/GlossaryTerm.d.ts +0 -10
  130. package/lib/helpers/GlossaryTerm.js +0 -22
  131. package/lib/helpers/MathHelper.d.ts +0 -99
  132. package/lib/helpers/MathHelper.js +0 -194
  133. package/lib/helpers/tinymce/plugin.d.ts +0 -2
  134. package/lib/helpers/tinymce/plugin.js +0 -86
  135. package/lib/i18n/en-US/components/content/blocks/image.d.ts +0 -6
  136. package/lib/i18n/en-US/components/content/blocks/image.js +0 -7
  137. package/lib/i18n/en-US/components/content/blocks/index.d.ts +0 -75
  138. package/lib/i18n/en-US/components/content/blocks/index.js +0 -14
  139. package/lib/i18n/en-US/components/content/blocks/tab.d.ts +0 -5
  140. package/lib/i18n/en-US/components/content/blocks/tab.js +0 -6
  141. package/lib/i18n/en-US/components/content/blocks/table.d.ts +0 -5
  142. package/lib/i18n/en-US/components/content/blocks/table.js +0 -6
  143. package/lib/i18n/en-US/components/content/blocks/user_upload.d.ts +0 -13
  144. package/lib/i18n/en-US/components/content/blocks/user_upload.js +0 -14
  145. package/lib/i18n/en-US/components/content/blocks/video.d.ts +0 -48
  146. package/lib/i18n/en-US/components/content/blocks/video.js +0 -49
  147. package/lib/i18n/en-US/components/content/index.d.ts +0 -77
  148. package/lib/i18n/en-US/components/content/index.js +0 -6
  149. package/lib/i18n/en-US/components/index.d.ts +0 -140
  150. package/lib/i18n/en-US/components/index.js +0 -12
  151. package/lib/i18n/en-US/components/navigation/image.d.ts +0 -5
  152. package/lib/i18n/en-US/components/navigation/image.js +0 -6
  153. package/lib/i18n/en-US/components/navigation/index.d.ts +0 -10
  154. package/lib/i18n/en-US/components/navigation/index.js +0 -8
  155. package/lib/i18n/en-US/components/navigation/user_upload.d.ts +0 -4
  156. package/lib/i18n/en-US/components/navigation/user_upload.js +0 -5
  157. package/lib/i18n/en-US/components/settings/clickable_icon.d.ts +0 -6
  158. package/lib/i18n/en-US/components/settings/clickable_icon.js +0 -7
  159. package/lib/i18n/en-US/components/settings/image.d.ts +0 -2
  160. package/lib/i18n/en-US/components/settings/image.js +0 -3
  161. package/lib/i18n/en-US/components/settings/index.d.ts +0 -39
  162. package/lib/i18n/en-US/components/settings/index.js +0 -14
  163. package/lib/i18n/en-US/components/settings/text_editor.d.ts +0 -8
  164. package/lib/i18n/en-US/components/settings/text_editor.js +0 -9
  165. package/lib/i18n/en-US/components/settings/user_upload.d.ts +0 -12
  166. package/lib/i18n/en-US/components/settings/user_upload.js +0 -13
  167. package/lib/i18n/en-US/components/settings/video.d.ts +0 -13
  168. package/lib/i18n/en-US/components/settings/video.js +0 -14
  169. package/lib/i18n/en-US/components/utils/index.d.ts +0 -15
  170. package/lib/i18n/en-US/components/utils/index.js +0 -6
  171. package/lib/i18n/en-US/components/utils/tiny_mce_wrapper.d.ts +0 -13
  172. package/lib/i18n/en-US/components/utils/tiny_mce_wrapper.js +0 -14
  173. package/lib/i18n/en-US/index.d.ts +0 -197
  174. package/lib/i18n/en-US/index.js +0 -16
  175. package/lib/i18n/en-US/modules/index.d.ts +0 -2
  176. package/lib/i18n/en-US/modules/index.js +0 -6
  177. package/lib/i18n/en-US/pages/glossary.d.ts +0 -8
  178. package/lib/i18n/en-US/pages/glossary.js +0 -9
  179. package/lib/i18n/en-US/pages/index.d.ts +0 -13
  180. package/lib/i18n/en-US/pages/index.js +0 -8
  181. package/lib/i18n/en-US/pages/user_upload.d.ts +0 -4
  182. package/lib/i18n/en-US/pages/user_upload.js +0 -5
  183. package/lib/i18n/en-US/shared/content_blocks.d.ts +0 -20
  184. package/lib/i18n/en-US/shared/content_blocks.js +0 -21
  185. package/lib/i18n/en-US/shared/index.d.ts +0 -39
  186. package/lib/i18n/en-US/shared/index.js +0 -10
  187. package/lib/i18n/en-US/shared/menu.d.ts +0 -4
  188. package/lib/i18n/en-US/shared/menu.js +0 -5
  189. package/lib/i18n/en-US/shared/settings.d.ts +0 -15
  190. package/lib/i18n/en-US/shared/settings.js +0 -16
  191. package/lib/i18n/en-US.d.ts +0 -197
  192. package/lib/i18n/en-US.js +0 -15
  193. package/lib/models/UserFileAsset.d.ts +0 -5
  194. package/lib/models/UserFileAsset.js +0 -37
@@ -0,0 +1,191 @@
1
+ <template>
2
+ <v-container class="container-left-border">
3
+ <v-row
4
+ v-if="
5
+ block.metadata.config.title ||
6
+ block.metadata.config.instructions
7
+ "
8
+ >
9
+ <v-col cols="12" class="pb-0">
10
+ <h3 v-if="block.metadata.config.title">
11
+ {{ block.metadata.config.title }}
12
+ </h3>
13
+ <p v-if="block.metadata.config.instructions" class="pb-0 mb-0">
14
+ {{ block.metadata.config.instructions }}
15
+ </p>
16
+ </v-col>
17
+ </v-row>
18
+ <v-row>
19
+ <v-col cols="1">
20
+ <v-icon color="primary">mdi-format-quote-open</v-icon>
21
+ </v-col>
22
+ <v-col cols="11" class="pl-0">
23
+ <p class="pt-2">
24
+ {{ block.metadata.config.block_quote.quote }}
25
+ </p>
26
+ </v-col>
27
+ </v-row>
28
+ <v-row>
29
+ <v-col cols="12">
30
+ <p v-if="render">
31
+ {{ finalcitation
32
+ }}<span :class="classCitation">{{ finalsource }}</span>
33
+ </p>
34
+ <p v-if="!render">Citation Here</p>
35
+ </v-col>
36
+ </v-row>
37
+ </v-container>
38
+ </template>
39
+
40
+ <script>
41
+ import _ from 'lodash'
42
+ import BaseContentBlock from '~/components/Content/Blocks/BaseContentBlock'
43
+
44
+ export default {
45
+ name: 'ContentBlockTab',
46
+ extends: BaseContentBlock,
47
+ beforeMount() {
48
+ if (_.isEmpty(this.block)) {
49
+ this.block = {}
50
+ }
51
+ if (_.isEmpty(this.block.metadata)) {
52
+ this.block.metadata = {}
53
+ }
54
+ if (_.isEmpty(this.block.metadata.config)) {
55
+ this.block.metadata.config = {}
56
+ }
57
+ if (_.isEmpty(this.block.metadata.config.title)) {
58
+ this.block.metadata.config.title = ''
59
+ }
60
+ if (_.isEmpty(this.block.metadata.config.instructions)) {
61
+ this.block.metadata.config.instructions = ''
62
+ }
63
+ if (_.isEmpty(this.block.metadata.config.block_quote)) {
64
+ this.block.metadata.config.block_quote = {
65
+ quote: '',
66
+ author: '',
67
+ author_title: '',
68
+ organization: '',
69
+ source_title: '',
70
+ source_type: '',
71
+ }
72
+ }
73
+ this.block.body = 'block quote'
74
+ },
75
+ data() {
76
+ return {
77
+ finalcitation: '',
78
+ finalsource: '',
79
+ classCitation: '',
80
+ }
81
+ },
82
+ watch: {
83
+ render(newValue) {
84
+ if (newValue) {
85
+ this.createCitation()
86
+ }
87
+ },
88
+ },
89
+ mounted() {
90
+ this.createCitation()
91
+ },
92
+ methods: {
93
+ createCitation() {
94
+ this.finalcitation = ''
95
+ this.finalsource = ''
96
+ let counter = 0
97
+ for (const property in this.block.metadata.config.block_quote) {
98
+ // author details processed here counter added to see if a comma is needed before key
99
+ if (
100
+ property !== 'quote' &&
101
+ property !== 'source_type' &&
102
+ property !== 'source_title' &&
103
+ this.block.metadata.config.block_quote[property] !== null &&
104
+ this.block.metadata.config.block_quote[property] !== ''
105
+ ) {
106
+ if (counter > 0) {
107
+ //not first hit so a comma is needed before key
108
+ counter = counter + 1
109
+ this.finalcitation =
110
+ this.finalcitation +
111
+ ', ' +
112
+ this.block.metadata.config.block_quote[property]
113
+ } else {
114
+ //first hit, no comma needed
115
+ counter = counter + 1
116
+ this.finalcitation =
117
+ '—' +
118
+ this.finalcitation +
119
+ this.block.metadata.config.block_quote[property]
120
+ }
121
+ // checks that source_type isn't none and there is a source title
122
+ } else if (
123
+ property === 'source_title' &&
124
+ this.block.metadata.config.block_quote['source_type'] !==
125
+ 'None' &&
126
+ this.block.metadata.config.block_quote[property] !== null &&
127
+ this.block.metadata.config.block_quote[property] !== ''
128
+ ) {
129
+ // filters out source types book. Adds class to italicize books
130
+ if (
131
+ this.block.metadata.config.block_quote[
132
+ 'source_type'
133
+ ] === 'Book'
134
+ ) {
135
+ // checks if comma needed or not
136
+ if (counter > 0) {
137
+ this.finalsource =
138
+ ', ' +
139
+ this.block.metadata.config.block_quote[property]
140
+ this.classCitation = 'span-title'
141
+ } else {
142
+ this.finalsource =
143
+ '—' +
144
+ this.block.metadata.config.block_quote[property]
145
+ this.classCitation = 'span-title'
146
+ }
147
+ //checks if online journal
148
+ } else if (
149
+ this.block.metadata.config.block_quote[
150
+ 'source_type'
151
+ ] === 'Online Journal'
152
+ ) {
153
+ // checks if comma needed or not. Not Italicized
154
+ if (counter > 0) {
155
+ this.finalsource =
156
+ ', ' +
157
+ '"' +
158
+ this.block.metadata.config.block_quote[
159
+ property
160
+ ] +
161
+ '"'
162
+ this.classCitation = ''
163
+ } else {
164
+ this.finalsource =
165
+ '—' +
166
+ '"' +
167
+ this.block.metadata.config.block_quote[
168
+ property
169
+ ] +
170
+ '"'
171
+ this.classCitation = ''
172
+ }
173
+ }
174
+ }
175
+ }
176
+ },
177
+ },
178
+ }
179
+ </script>
180
+
181
+ <style scoped>
182
+ .container-left-border {
183
+ border-style: solid;
184
+ border-color: var(--v-secondary-base);
185
+ border-width: 2px 2px 2px 16px;
186
+ border-radius: 4px;
187
+ }
188
+ .span-title {
189
+ font-style: italic;
190
+ }
191
+ </style>
@@ -1,42 +1,60 @@
1
1
  <template>
2
2
  <div>
3
3
  <v-container>
4
- <v-row no-gutters>
5
- <h3>{{ block.metadata.config.title }}</h3>
6
- </v-row>
7
- <v-row no-gutters>
8
- <h4>{{ block.metadata.config.description }}</h4>
9
- </v-row>
10
- <v-row no-gutters>
11
- <p>
12
- {{
13
- $t(
14
- 'windward.core.components.settings.clickable_icon.information'
15
- )
16
- }}
17
- </p>
18
- </v-row>
4
+ <h3>{{ block.metadata.config.title }}</h3>
5
+
6
+ <h4>{{ block.metadata.config.description }}</h4>
7
+
8
+ <p>
9
+ {{
10
+ $t(
11
+ 'windward.core.components.settings.clickable_icon.information'
12
+ )
13
+ }}
14
+ </p>
19
15
  </v-container>
20
16
  <v-container>
21
17
  <v-row
22
18
  v-for="(item, itemIndex) in block.metadata.config.items"
23
19
  :key="itemIndex"
24
20
  no-gutters
21
+ :class="rowClass(itemIndex)"
25
22
  >
26
23
  <v-col cols="2">
27
24
  <v-btn
28
25
  class="pt-8 pb-8 outlined-button mb-4"
29
- :color="itemColor(item.color)"
26
+ :color="itemColor(itemIndex)"
27
+ :fab="block.metadata.config.display.round_icon"
30
28
  x-large
31
29
  outlined
32
30
  @click="item.active = !item.active"
33
31
  >
34
- <v-icon>{{ onHandleHtmlEntities(item.icon) }}</v-icon>
32
+ <v-icon v-if="isIcon(item.icon)" class="black--text">{{
33
+ item.icon
34
+ }}</v-icon>
35
+ <span v-else :class="iconClass + ' black--text'">{{
36
+ decode(item.icon)
37
+ }}</span>
35
38
  </v-btn>
36
39
  </v-col>
37
- <v-col cols="10" v-if="item.active">
38
- <h4>{{ item.title }}</h4>
39
- <TextViewer v-model="item.body"></TextViewer>
40
+ <v-col cols="10">
41
+ <h4
42
+ v-if="
43
+ block.metadata.config.display.show_title ||
44
+ item.active
45
+ "
46
+ class="mt-4"
47
+ role="button"
48
+ @click="item.active = !item.active"
49
+ >
50
+ {{ item.title }}
51
+ </h4>
52
+ <v-expand-transition>
53
+ <div v-if="item.active">
54
+ <v-divider light class="my-4" />
55
+ <TextViewer v-model="item.body"></TextViewer>
56
+ </div>
57
+ </v-expand-transition>
40
58
  </v-col>
41
59
  </v-row>
42
60
  </v-container>
@@ -44,6 +62,7 @@
44
62
  </template>
45
63
  <script>
46
64
  import _ from 'lodash'
65
+ import he from 'he'
47
66
  import BaseContentBlock from '~/components/Content/Blocks/BaseContentBlock'
48
67
  import TextViewer from '~/components/Text/TextViewer'
49
68
 
@@ -53,13 +72,77 @@ export default {
53
72
  TextViewer,
54
73
  },
55
74
  extends: BaseContentBlock,
75
+ data() {
76
+ return {}
77
+ },
56
78
  computed: {
79
+ decode() {
80
+ return (str) => {
81
+ return he.decode(str || '')
82
+ }
83
+ },
84
+ rowClass() {
85
+ return (itemIndex) => {
86
+ let classes = 'option-container mb-4 pa-1'
87
+ // If show background is enabled and the item has a color
88
+ // Otherwise we do NOT want to apply the `black--text` class since there's no color
89
+ // And things will look bad in dark mode
90
+ if (
91
+ _.get(
92
+ this.block,
93
+ 'metadata.config.display.show_background',
94
+ false
95
+ ) &&
96
+ this.itemColor(itemIndex)
97
+ ) {
98
+ classes += ' ' + this.itemColor(itemIndex) + ' black--text'
99
+ }
100
+ return classes
101
+ }
102
+ },
103
+ iconClass() {
104
+ let classes = 'text-icon'
105
+ if (
106
+ _.get(this.block, 'metadata.config.display.italic_icon', false)
107
+ ) {
108
+ classes += ' font-italic'
109
+ }
110
+ return classes
111
+ },
57
112
  itemColor() {
58
- return (v) => {
59
- if (_.isObject(v)) {
60
- return _.get(v, 'class', '')
113
+ return (itemIndex) => {
114
+ // If autocolor is enabled then calculate the color on the index
115
+ if (this.block.metadata.config.display.autocolor) {
116
+ const colors = [
117
+ 'light-blue lighten-4',
118
+ 'light-green lighten-4',
119
+ 'yellow lighten-4',
120
+ 'orange lighten-3',
121
+ 'red lighten-3',
122
+ 'deep-purple lighten-3',
123
+ ]
124
+ let colorIndex = itemIndex
125
+ // If we exceed the above list of colors loop back around to the beginning
126
+ if (colorIndex >= colors.length) {
127
+ colorIndex =
128
+ colorIndex -
129
+ Math.floor(colorIndex / colors.length) *
130
+ colors.length
131
+ }
132
+
133
+ return colors[colorIndex]
61
134
  } else {
62
- return v
135
+ // Otherwise get the predefined color
136
+ const color = _.get(
137
+ this.block,
138
+ 'metadata.config.items[' + itemIndex + '].color',
139
+ ''
140
+ )
141
+ if (_.isObject(color)) {
142
+ return _.get(color, 'class', '')
143
+ } else {
144
+ return color
145
+ }
63
146
  }
64
147
  }
65
148
  },
@@ -76,32 +159,37 @@ export default {
76
159
  if (_.isEmpty(this.block.metadata.config.description)) {
77
160
  this.block.metadata.config.description = ''
78
161
  }
79
- if (this.block.metadata.config.items) {
80
- this.block.metadata.config.items.forEach((element) => {
81
- element.active = false
82
- })
162
+ if (_.isEmpty(this.block.metadata.config.display)) {
163
+ this.block.metadata.config.display = {
164
+ show_title: false,
165
+ show_background: false,
166
+ round_icon: false,
167
+ italic_icon: false,
168
+ autocolor: true,
169
+ }
83
170
  }
84
- },
85
- data() {
86
- return {
87
- api_key: process.env.TINY_MCE_API_KEY,
88
- title: 'Title',
89
- displayText: false,
171
+ if (this.block.metadata.config.items.length) {
172
+ for (const index in this.block.metadata.config.items) {
173
+ this.block.metadata.config.items[index].active = false
174
+ }
90
175
  }
91
176
  },
92
177
  methods: {
93
- onHandleHtmlEntities(str) {
94
- let txt = document.createElement('textarea')
95
-
96
- txt.innerHTML = str
97
-
98
- return txt.value
178
+ isIcon(str) {
179
+ return str && _.isString(str) && str.indexOf('mdi-') === 0
99
180
  },
100
181
  },
101
182
  }
102
183
  </script>
103
184
  <style scoped>
185
+ .option-container {
186
+ border-radius: 1rem;
187
+ }
104
188
  .outlined-button {
105
189
  border-width: 4px;
190
+ background: #fff;
191
+ }
192
+ .text-icon {
193
+ font-size: 1.5rem;
106
194
  }
107
195
  </style>
@@ -3,7 +3,7 @@
3
3
  <p class="question">
4
4
  {{ value.body }}
5
5
  </p>
6
- <div class="d-flex justify-space-around">
6
+ <div class="d-flex">
7
7
  <v-radio-group
8
8
  :rules="[
9
9
  (v) =>
@@ -12,12 +12,12 @@
12
12
  'windward.core.components.content.blocks.feedback.required'
13
13
  ),
14
14
  ]"
15
- row
16
15
  class="radio-group"
16
+ :row="row"
17
+ :column="column"
17
18
  v-model="value.response"
18
19
  >
19
20
  <v-radio
20
- class="likert-radio"
21
21
  color="green"
22
22
  :label="
23
23
  $t(
@@ -27,7 +27,6 @@
27
27
  value="5"
28
28
  ></v-radio>
29
29
  <v-radio
30
- class="likert-radio"
31
30
  color="light-green"
32
31
  :label="
33
32
  $t(
@@ -37,7 +36,6 @@
37
36
  value="4"
38
37
  ></v-radio>
39
38
  <v-radio
40
- class="likert-radio"
41
39
  color="amber"
42
40
  :label="
43
41
  $t(
@@ -47,7 +45,6 @@
47
45
  value="3"
48
46
  ></v-radio>
49
47
  <v-radio
50
- class="likert-radio"
51
48
  color="orange"
52
49
  :label="
53
50
  $t(
@@ -57,7 +54,6 @@
57
54
  value="2"
58
55
  ></v-radio>
59
56
  <v-radio
60
- class="likert-radio"
61
57
  color="red"
62
58
  :label="
63
59
  $t(
@@ -78,7 +74,28 @@ export default {
78
74
  value: { type: Object, required: true, default: '' },
79
75
  },
80
76
  data() {
81
- return {}
77
+ return {
78
+ windowWidth: window.innerWidth,
79
+ row: true,
80
+ column: false,
81
+ }
82
+ },
83
+ mounted() {
84
+ this.$nextTick(() => {
85
+ window.addEventListener('resize', this.onResize)
86
+ })
87
+ },
88
+ methods: {
89
+ onResize() {
90
+ this.windowWidth = window.innerWidth
91
+ if (this.windowWidth <= 760) {
92
+ this.row = false
93
+ this.column = true
94
+ } else {
95
+ this.row = true
96
+ this.column = false
97
+ }
98
+ },
82
99
  },
83
100
  }
84
101
  </script>
@@ -86,10 +103,4 @@ export default {
86
103
  .question {
87
104
  font-weight: bold;
88
105
  }
89
- .radio-group {
90
- width: 100% !important;
91
- }
92
- .likert-radio {
93
- margin-left: 55px;
94
- }
95
106
  </style>
@@ -24,7 +24,9 @@
24
24
  ></v-radio>
25
25
  <v-radio
26
26
  class="likert-radio"
27
- :label="$t('windward.core.components.content.blocks.feedback.no')"
27
+ :label="
28
+ $t('windward.core.components.content.blocks.feedback.no')
29
+ "
28
30
  value="false"
29
31
  ></v-radio>
30
32
  </v-radio-group>
@@ -46,10 +48,4 @@ export default {
46
48
  .question {
47
49
  font-weight: bold;
48
50
  }
49
- .radio-group {
50
- width: 100% !important;
51
- }
52
- .likert-radio {
53
- margin-left: 55px;
54
- }
55
51
  </style>
@@ -25,7 +25,7 @@
25
25
  :src="block.body"
26
26
  contain
27
27
  >
28
- <template v-slot:placeholder>
28
+ <template #placeholder>
29
29
  <v-skeleton-loader
30
30
  type="image, image, list-item-avatar"
31
31
  height="100%"
@@ -121,7 +121,7 @@ export default {
121
121
  border-radius: 3px;
122
122
  }
123
123
  .img-holder {
124
- max-height: 300px;
124
+ height: 300px;
125
125
  }
126
126
  .img-white {
127
127
  background: #fff;
@@ -128,22 +128,28 @@ export default {
128
128
  // Check to see if we have a state already for this block with the same block_id
129
129
  // States are loaded via the ContentBlock.id but in this particular case we want to
130
130
  // maintain the state ACROSS different ContentBlock.ids but with the same linked Block.id
131
- const userState = await UserContentBlockState.where({
132
- 'metadata->block->tag': 'plugin-core-open-response',
133
- course_user_id: this.enrollment.id,
134
- })
135
- .where('metadata->block->block_id', this.block.block_id)
136
- .first()
131
+ if (this.block.block_id) {
132
+ const userState = await UserContentBlockState.where({
133
+ 'metadata->block->tag': 'plugin-core-open-response',
134
+ course_user_id: this.enrollment.id,
135
+ })
136
+ .where('metadata->block->block_id', this.block.block_id)
137
+ .first()
137
138
 
138
- // Apply the "True" state
139
- if (!_.isEmpty(userState)) {
140
- this.response = _.get(userState, 'metadata.response', '')
141
- this.submitted = _.get(userState, 'metadata.submitted', false)
142
- }
139
+ // Apply the "True" state
140
+ if (!_.isEmpty(userState)) {
141
+ this.response = _.get(userState, 'metadata.response', '')
142
+ this.submitted = _.get(
143
+ userState,
144
+ 'metadata.submitted',
145
+ false
146
+ )
147
+ }
143
148
 
144
- // If after the state is applied the response is still empty then apply the default response
145
- if (this.response === '') {
146
- this.response = this.block.metadata.config.starting_text
149
+ // If after the state is applied the response is still empty then apply the default response
150
+ if (this.response === '') {
151
+ this.response = this.block.metadata.config.starting_text
152
+ }
147
153
  }
148
154
 
149
155
  this.stateLoaded = true