Skip to content

Commit 9c4a4d4

Browse files
committed
Merge branch 'links'
# Conflicts: # src/models/QuestionModel.js
2 parents 1c981ff + 427df4f commit 9c4a4d4

File tree

6 files changed

+53
-11
lines changed

6 files changed

+53
-11
lines changed

examples/questionnaire/Example.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
7070
// Import necessary components and classes
7171
import FlowForm from '../../src/components/FlowForm.vue'
72-
import QuestionModel, { QuestionType, ChoiceOption } from '../../src/models/QuestionModel'
72+
import QuestionModel, { QuestionType, ChoiceOption, LinkOption } from '../../src/models/QuestionModel'
7373
import LanguageModel from '../../src/models/LanguageModel'
7474
// If using the npm package, use the following line instead of the ones above.
7575
// import FlowForm, { QuestionModel, QuestionType, ChoiceOption, LanguageModel } from '@ditdot-dev/vue-flow-form'
@@ -88,7 +88,7 @@
8888
questions: [
8989
new QuestionModel({
9090
id: 'first_name',
91-
tagline: "Hi! Welcome to our demo survey 😊",
91+
tagline: 'Hi! Welcome to our demo survey 😊',
9292
title: 'What is your first name?',
9393
type: QuestionType.Text,
9494
required: true,
@@ -97,7 +97,7 @@
9797
new QuestionModel({
9898
id: 'email',
9999
tagline: "Nice to meet you 👀, let's continue",
100-
title: "Provide an example email.",
100+
title: 'Provide an example email.',
101101
type: QuestionType.Email,
102102
required: true,
103103
placeholder: 'Start typing here...'
@@ -118,7 +118,7 @@
118118
}),
119119
new QuestionModel({
120120
id: 'multiple_choice',
121-
tagline: "FYI, You can always go back 👈, use the up arrow on the bottom.",
121+
tagline: 'FYI, You can always go back 👈, use the up arrow on the bottom.',
122122
title: 'Multiple choice question:',
123123
helpTextShow: false,
124124
type: QuestionType.MultipleChoice,
@@ -168,7 +168,7 @@
168168
}),
169169
new QuestionModel({
170170
id: 'choose_path',
171-
tagline: "Where would you like to go? 🤔",
171+
tagline: 'Where would you like to go? 🤔',
172172
title: 'Choose your path:',
173173
type: QuestionType.Dropdown,
174174
multiple: false,
@@ -199,7 +199,7 @@
199199
}),
200200
new QuestionModel({
201201
id: 'path_b',
202-
tagline: "Path B",
202+
tagline: 'Path B',
203203
title: 'Hmm, are you sure?',
204204
helpText: 'Path A sounds like a winner! 😉',
205205
type: QuestionType.MultipleChoice,

examples/quiz/Example.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
}),
108108
new QuestionModel({
109109
id: 'html_1',
110-
title: "Which of the following are valid input field types? ",
110+
title: 'Which of the following are valid input field types?',
111111
helpText: 'Choose all answers that apply.',
112112
type: QuestionType.MultipleChoice,
113113
required: true,

src/assets/css/common.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,24 @@ span.f-answered{
333333
height: auto;
334334
}
335335

336+
/*links*/
337+
338+
a.f-link,
339+
.field-submittype .section-wrap a {
340+
margin-right: 10px;
341+
color: inherit;
342+
border-bottom: 1px solid;
343+
white-space: pre-wrap;
344+
}
345+
346+
a.f-link:hover,
347+
a.f-link:active,
348+
.field-submittype .section-wrap a:hover,
349+
.field-submittype .section-wrap a:active {
350+
color: inherit;
351+
border-bottom: none;
352+
}
353+
336354
/*typography*/
337355
li,
338356
p,

src/components/Question.vue

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,19 @@
4949
/>
5050
</div>
5151
</div>
52-
<p v-if="question.description" class="description">{{ question.description }}</p>
52+
<p v-if="question.description || question.descriptionLink" class="description">
53+
{{ question.description }}
54+
<a
55+
v-for="(link, index) in question.descriptionLink"
56+
class="f-link"
57+
v-bind:key="'m' + index"
58+
v-bind:href="link.url"
59+
v-bind:target="link.target"
60+
>
61+
{{ link.text || link.url }}
62+
</a>
63+
</p>
64+
5365
</div>
5466
<div class="animate fade-in f-enter" v-if="showOkButton()">
5567
<button
@@ -85,7 +97,7 @@
8597
*/
8698
8799
import LanguageModel from '../models/LanguageModel'
88-
import QuestionModel, { QuestionType } from '../models/QuestionModel'
100+
import QuestionModel, { QuestionType, LinkOption } from '../models/QuestionModel'
89101
import FlowFormDropdownType from './QuestionTypes/DropdownType.vue'
90102
import FlowFormEmailType from './QuestionTypes/EmailType.vue'
91103
import FlowFormLongTextType from './QuestionTypes/LongTextType.vue'

src/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Import vue component
22
import FlowForm from './components/FlowForm.vue'
3-
import QuestionModel, { QuestionType, ChoiceOption } from './models/QuestionModel'
3+
import QuestionModel, { QuestionType, ChoiceOption, LinkOption } from './models/QuestionModel'
44
import LanguageModel from './models/LanguageModel'
55

66
// IE11 Object.assign polyfill
@@ -36,5 +36,6 @@ export {
3636
QuestionModel,
3737
QuestionType,
3838
ChoiceOption,
39+
LinkOption,
3940
LanguageModel
4041
}

src/models/QuestionModel.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ export class ChoiceOption {
4747
}
4848
}
4949

50+
export class LinkOption {
51+
constructor(options) {
52+
this.url = ''
53+
this.text = ''
54+
this.target = '_blank'
55+
56+
Object.assign(this, options)
57+
}
58+
}
59+
5060
export default class QuestionModel {
5161
constructor(options) {
5262
this.id = null
@@ -73,6 +83,7 @@ export default class QuestionModel {
7383
this.inline = false
7484
this.helpText = null
7585
this.helpTextShow = true
86+
this.descriptionLink = []
7687

7788
Object.assign(this, options)
7889

@@ -115,4 +126,4 @@ export default class QuestionModel {
115126

116127
this.index = index
117128
}
118-
}
129+
}

0 commit comments

Comments
 (0)