@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.
- package/components/Content/Blocks/BlockQuote.vue +191 -0
- package/components/Content/Blocks/ClickableIcons.vue +128 -40
- package/components/Content/Blocks/FeedbackTemplates/FeedbackQuestionLikert.vue +25 -14
- package/components/Content/Blocks/FeedbackTemplates/FeedbackQuestionTrueFalse.vue +3 -7
- package/components/Content/Blocks/Image.vue +2 -2
- package/components/Content/Blocks/OpenResponse.vue +20 -14
- package/components/Content/Blocks/ScenarioChoice.vue +262 -0
- package/components/Content/Blocks/Tab.vue +2 -7
- package/components/Settings/AccordionSettings.vue +97 -74
- package/components/Settings/BlockQuoteSettings.vue +143 -0
- package/components/Settings/ClickableIconsSettings.vue +101 -86
- package/components/Settings/OpenResponseSettings.vue +6 -8
- package/components/Settings/ScenarioChoiceSettings.vue +329 -0
- package/components/Settings/TabSettings.vue +79 -62
- package/components/Settings/TextEditorSettings.vue +1 -3
- package/components/utils/FillInBlank/FillInBlankInput.vue +4 -1
- package/components/utils/MathExpressionEditor.vue +30 -15
- package/components/utils/TinyMCEWrapper.vue +3 -1
- package/helpers/FillInBlankHelper.ts +0 -2
- package/i18n/en-US/components/content/blocks/block_quote.ts +3 -0
- package/i18n/en-US/components/content/blocks/index.ts +4 -2
- package/i18n/en-US/components/content/blocks/scenario_choice.ts +5 -0
- package/i18n/en-US/components/settings/accordion.ts +5 -0
- package/i18n/en-US/components/settings/block_quote.ts +9 -0
- package/i18n/en-US/components/settings/clickable_icon.ts +8 -0
- package/i18n/en-US/components/settings/index.ts +8 -0
- package/i18n/en-US/components/settings/scenario_choice.ts +19 -0
- package/i18n/en-US/components/settings/tab.ts +7 -0
- package/i18n/en-US/components/utils/FillInBlank/FillInBlankInput.ts +1 -1
- package/i18n/en-US/components/utils/index.ts +2 -0
- package/i18n/en-US/components/utils/math_expression_editor.ts +3 -0
- package/i18n/en-US/shared/content_blocks.ts +2 -0
- package/i18n/en-US/shared/settings.ts +4 -0
- package/i18n/es-ES/components/content/blocks/block_quote.ts +3 -0
- package/i18n/es-ES/components/content/blocks/feedback.ts +2 -0
- package/i18n/es-ES/components/content/blocks/index.ts +4 -2
- package/i18n/es-ES/components/content/blocks/scenario_choice.ts +6 -0
- package/i18n/es-ES/components/navigation/index.ts +2 -0
- package/i18n/es-ES/components/settings/accordion.ts +5 -0
- package/i18n/es-ES/components/settings/block_quote.ts +9 -0
- package/i18n/es-ES/components/settings/clickable_icon.ts +8 -0
- package/i18n/es-ES/components/settings/index.ts +8 -0
- package/i18n/es-ES/components/settings/scenario_choice.ts +19 -0
- package/i18n/es-ES/components/{content/blocks → settings}/tab.ts +3 -0
- package/i18n/es-ES/components/utils/FillInBlank/FillInBlankInput.ts +13 -0
- package/i18n/es-ES/components/utils/FillInBlank/FillInTheBlanksManager.ts +11 -0
- package/i18n/es-ES/components/utils/FillInBlank/index.ts +6 -0
- package/i18n/es-ES/components/utils/index.ts +4 -1
- package/i18n/es-ES/components/utils/math_expression_editor.ts +3 -0
- package/i18n/es-ES/components/utils/tiny_mce_wrapper.ts +1 -0
- package/i18n/es-ES/shared/content_blocks.ts +2 -0
- package/i18n/es-ES/shared/menu.ts +1 -0
- package/i18n/es-ES/shared/settings.ts +4 -0
- package/i18n/index.ts +11 -0
- package/i18n/sv-SE/components/content/blocks/block_quote.ts +3 -0
- package/i18n/sv-SE/components/content/blocks/feedback.ts +2 -0
- package/i18n/sv-SE/components/content/blocks/index.ts +4 -2
- package/i18n/sv-SE/components/content/blocks/scenario_choice.ts +5 -0
- package/i18n/sv-SE/components/navigation/index.ts +2 -0
- package/i18n/sv-SE/components/settings/accordion.ts +5 -0
- package/i18n/sv-SE/components/settings/block_quote.ts +9 -0
- package/i18n/sv-SE/components/settings/clickable_icon.ts +8 -0
- package/i18n/sv-SE/components/settings/index.ts +8 -0
- package/i18n/sv-SE/components/settings/scenario_choice.ts +19 -0
- package/i18n/sv-SE/components/{content/blocks → settings}/tab.ts +3 -0
- package/i18n/sv-SE/components/utils/FillInBlank/FillInBlankInput.ts +13 -0
- package/i18n/sv-SE/components/utils/FillInBlank/FillInTheBlanksManager.ts +11 -0
- package/i18n/sv-SE/components/utils/FillInBlank/index.ts +6 -0
- package/i18n/sv-SE/components/utils/index.ts +4 -1
- package/i18n/sv-SE/components/utils/math_expression_editor.ts +3 -0
- package/i18n/sv-SE/components/utils/tiny_mce_wrapper.ts +1 -0
- package/i18n/sv-SE/shared/content_blocks.ts +2 -0
- package/i18n/sv-SE/shared/menu.ts +1 -0
- package/i18n/sv-SE/shared/settings.ts +4 -0
- package/package.json +5 -4
- package/plugin.js +45 -5
- package/test/Components/Content/Blocks/BlockQuote.spec.js +21 -0
- package/test/Components/Content/Blocks/ScenarioChoice.spec.js +21 -0
- package/test/Components/Settings/BlockQuoteSettings.spec.js +20 -0
- package/test/Components/Settings/ClickableIconsSettings.spec.js +1 -1
- package/test/Components/Settings/ScenarioChoiceSettings.spec.js +20 -0
- package/test/Feature/LocaleKeys.spec.js +9 -0
- package/test/__mocks__/componentsMock.js +24 -0
- package/test/locales.js +95 -0
- package/.idea/codeStyles/Project.xml +0 -58
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/php-docker-settings.xml +0 -24
- package/.idea/php.xml +0 -19
- package/.idea/vcs.xml +0 -6
- package/.idea/watcherTasks.xml +0 -4
- package/.idea/windward-ui-plugin-core.iml +0 -8
- package/coverage/clover.xml +0 -223
- package/coverage/coverage-final.json +0 -16
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/components/Content/Blocks/Accordion.vue.html +0 -430
- package/coverage/lcov-report/components/Content/Blocks/Image.vue.html +0 -394
- package/coverage/lcov-report/components/Content/Blocks/Math.vue.html +0 -262
- package/coverage/lcov-report/components/Content/Blocks/RichText.vue.html +0 -295
- package/coverage/lcov-report/components/Content/Blocks/Tab.vue.html +0 -415
- package/coverage/lcov-report/components/Content/Blocks/Table.vue.html +0 -667
- package/coverage/lcov-report/components/Content/Blocks/Video.vue.html +0 -2275
- package/coverage/lcov-report/components/Content/Blocks/index.html +0 -206
- package/coverage/lcov-report/components/utils/ContentViewer.vue.html +0 -199
- package/coverage/lcov-report/components/utils/MathExpressionEditor.vue.html +0 -919
- package/coverage/lcov-report/components/utils/MathLiveWrapper.vue.html +0 -343
- package/coverage/lcov-report/components/utils/TinyMCEWrapper.vue.html +0 -271
- package/coverage/lcov-report/components/utils/index.html +0 -161
- package/coverage/lcov-report/config/index.html +0 -116
- package/coverage/lcov-report/config/tinymce.config.js.html +0 -493
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/helpers/MathHelper.ts.html +0 -793
- package/coverage/lcov-report/helpers/index.html +0 -116
- package/coverage/lcov-report/helpers/tinymce/index.html +0 -116
- package/coverage/lcov-report/helpers/tinymce/plugin.ts.html +0 -334
- package/coverage/lcov-report/index.html +0 -191
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov-report/test/index.html +0 -116
- package/coverage/lcov-report/test/mocks.js.html +0 -457
- package/coverage/lcov.info +0 -403
- package/i18n/en-US/components/content/blocks/tab.ts +0 -4
- package/lib/helpers/GlossaryHelper.d.ts +0 -9
- package/lib/helpers/GlossaryHelper.js +0 -118
- package/lib/helpers/GlossaryTerm.d.ts +0 -10
- package/lib/helpers/GlossaryTerm.js +0 -22
- package/lib/helpers/MathHelper.d.ts +0 -99
- package/lib/helpers/MathHelper.js +0 -194
- package/lib/helpers/tinymce/plugin.d.ts +0 -2
- package/lib/helpers/tinymce/plugin.js +0 -86
- package/lib/i18n/en-US/components/content/blocks/image.d.ts +0 -6
- package/lib/i18n/en-US/components/content/blocks/image.js +0 -7
- package/lib/i18n/en-US/components/content/blocks/index.d.ts +0 -75
- package/lib/i18n/en-US/components/content/blocks/index.js +0 -14
- package/lib/i18n/en-US/components/content/blocks/tab.d.ts +0 -5
- package/lib/i18n/en-US/components/content/blocks/tab.js +0 -6
- package/lib/i18n/en-US/components/content/blocks/table.d.ts +0 -5
- package/lib/i18n/en-US/components/content/blocks/table.js +0 -6
- package/lib/i18n/en-US/components/content/blocks/user_upload.d.ts +0 -13
- package/lib/i18n/en-US/components/content/blocks/user_upload.js +0 -14
- package/lib/i18n/en-US/components/content/blocks/video.d.ts +0 -48
- package/lib/i18n/en-US/components/content/blocks/video.js +0 -49
- package/lib/i18n/en-US/components/content/index.d.ts +0 -77
- package/lib/i18n/en-US/components/content/index.js +0 -6
- package/lib/i18n/en-US/components/index.d.ts +0 -140
- package/lib/i18n/en-US/components/index.js +0 -12
- package/lib/i18n/en-US/components/navigation/image.d.ts +0 -5
- package/lib/i18n/en-US/components/navigation/image.js +0 -6
- package/lib/i18n/en-US/components/navigation/index.d.ts +0 -10
- package/lib/i18n/en-US/components/navigation/index.js +0 -8
- package/lib/i18n/en-US/components/navigation/user_upload.d.ts +0 -4
- package/lib/i18n/en-US/components/navigation/user_upload.js +0 -5
- package/lib/i18n/en-US/components/settings/clickable_icon.d.ts +0 -6
- package/lib/i18n/en-US/components/settings/clickable_icon.js +0 -7
- package/lib/i18n/en-US/components/settings/image.d.ts +0 -2
- package/lib/i18n/en-US/components/settings/image.js +0 -3
- package/lib/i18n/en-US/components/settings/index.d.ts +0 -39
- package/lib/i18n/en-US/components/settings/index.js +0 -14
- package/lib/i18n/en-US/components/settings/text_editor.d.ts +0 -8
- package/lib/i18n/en-US/components/settings/text_editor.js +0 -9
- package/lib/i18n/en-US/components/settings/user_upload.d.ts +0 -12
- package/lib/i18n/en-US/components/settings/user_upload.js +0 -13
- package/lib/i18n/en-US/components/settings/video.d.ts +0 -13
- package/lib/i18n/en-US/components/settings/video.js +0 -14
- package/lib/i18n/en-US/components/utils/index.d.ts +0 -15
- package/lib/i18n/en-US/components/utils/index.js +0 -6
- package/lib/i18n/en-US/components/utils/tiny_mce_wrapper.d.ts +0 -13
- package/lib/i18n/en-US/components/utils/tiny_mce_wrapper.js +0 -14
- package/lib/i18n/en-US/index.d.ts +0 -197
- package/lib/i18n/en-US/index.js +0 -16
- package/lib/i18n/en-US/modules/index.d.ts +0 -2
- package/lib/i18n/en-US/modules/index.js +0 -6
- package/lib/i18n/en-US/pages/glossary.d.ts +0 -8
- package/lib/i18n/en-US/pages/glossary.js +0 -9
- package/lib/i18n/en-US/pages/index.d.ts +0 -13
- package/lib/i18n/en-US/pages/index.js +0 -8
- package/lib/i18n/en-US/pages/user_upload.d.ts +0 -4
- package/lib/i18n/en-US/pages/user_upload.js +0 -5
- package/lib/i18n/en-US/shared/content_blocks.d.ts +0 -20
- package/lib/i18n/en-US/shared/content_blocks.js +0 -21
- package/lib/i18n/en-US/shared/index.d.ts +0 -39
- package/lib/i18n/en-US/shared/index.js +0 -10
- package/lib/i18n/en-US/shared/menu.d.ts +0 -4
- package/lib/i18n/en-US/shared/menu.js +0 -5
- package/lib/i18n/en-US/shared/settings.d.ts +0 -15
- package/lib/i18n/en-US/shared/settings.js +0 -16
- package/lib/i18n/en-US.d.ts +0 -197
- package/lib/i18n/en-US.js +0 -15
- package/lib/models/UserFileAsset.d.ts +0 -5
- 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
|
-
<
|
|
5
|
-
|
|
6
|
-
</
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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(
|
|
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
|
|
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"
|
|
38
|
-
<h4
|
|
39
|
-
|
|
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 (
|
|
59
|
-
|
|
60
|
-
|
|
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
|
-
|
|
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.
|
|
80
|
-
this.block.metadata.config.
|
|
81
|
-
|
|
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
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
-
|
|
94
|
-
|
|
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
|
|
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="
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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
|