Skip to content

Commit 160d874

Browse files
committed
Fix link option
1 parent ba54cdc commit 160d874

File tree

5 files changed

+26
-44
lines changed

5 files changed

+26
-44
lines changed

examples/questionnaire/Example.vue

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -88,43 +88,23 @@
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?',
93-
description: 'Some description',
94-
link: [
95-
new LinkOption({
96-
url: "https://www.ditdot.hr/",
97-
anchor: 'I am a DITDOT official page link',
98-
}),
99-
new LinkOption({
100-
url: "https://github.com/ditdot-dev/vue-flow-form",
101-
})
102-
],
10393
type: QuestionType.Text,
10494
required: true,
10595
placeholder: 'Start typing here...'
10696
}),
10797
new QuestionModel({
10898
id: 'email',
10999
tagline: "Nice to meet you 👀, let's continue",
110-
title: "Provide an example email.",
111-
link: [
112-
new LinkOption({
113-
url: "https://www.ditdot.hr/",
114-
anchor: 'I am a DITDOT official page link',
115-
}),
116-
new LinkOption({
117-
url: "https://github.com/ditdot-dev/vue-flow-form",
118-
})
119-
],
100+
title: 'Provide an example email.',
120101
type: QuestionType.Email,
121102
required: true,
122103
placeholder: 'Start typing here...'
123104
}),
124105
new QuestionModel({
125106
id: 'phone',
126107
title: 'Doing great! 👍 Go ahead and try with a phone number.',
127-
description: 'Some description',
128108
type: QuestionType.Phone,
129109
required: true,
130110
mask: '(###) ###-####'
@@ -138,7 +118,7 @@
138118
}),
139119
new QuestionModel({
140120
id: 'multiple_choice',
141-
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.',
142122
title: 'Multiple choice question:',
143123
type: QuestionType.MultipleChoice,
144124
multiple: false,
@@ -188,7 +168,7 @@
188168
}),
189169
new QuestionModel({
190170
id: 'choose_path',
191-
tagline: "Where would you like to go? 🤔",
171+
tagline: 'Where would you like to go? 🤔',
192172
title: 'Choose your path:',
193173
type: QuestionType.Dropdown,
194174
multiple: false,
@@ -219,7 +199,7 @@
219199
}),
220200
new QuestionModel({
221201
id: 'path_b',
222-
tagline: "Path B",
202+
tagline: 'Path B',
223203
title: 'Hmm, are you sure?',
224204
helpText: 'Path A sounds like a winner! 😉',
225205
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: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -328,19 +328,21 @@ span.f-answered{
328328

329329
/*links*/
330330

331-
.link a {
332-
display: inline-block;
333-
height: 1.5rem;
331+
a.f-link {
334332
margin-right: 10px;
335333
color: inherit;
336334
border-bottom: 1px solid;
337-
338335
}
339336

340-
.link a:hover {
341-
border-bottom: none;
337+
a.f-link:first-of-type {
338+
margin-left: 7px;
342339
}
343340

341+
a.f-link:hover,
342+
a.f-link:active {
343+
color: inherit;
344+
border-bottom: none;
345+
}
344346

345347
/*typography*/
346348
li,

src/components/Question.vue

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,17 @@
4949
/>
5050
</div>
5151
</div>
52-
<p v-if="question.description ||question.link" class="description">
52+
<p v-if="question.description || question.descriptionLink" class="description">
5353
{{ question.description }}
54-
<span v-if="question.link">
55-
<span class="link"
56-
v-for="(link, index) in question.link"
57-
v-bind:key="'m' + index" v-html="link.formatLink()">
58-
</span>
59-
</span>
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>
6063
</p>
6164

6265
</div>

src/models/QuestionModel.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,11 @@ export class ChoiceOption {
5050
export class LinkOption {
5151
constructor(options) {
5252
this.url = ''
53-
this.anchor = 'Link'
53+
this.text = ''
5454
this.target = '_blank'
5555

5656
Object.assign(this, options)
5757
}
58-
formatLink() {
59-
return `<a href=${this.url} target=${this.target}>${this.anchor}</a>`
60-
}
6158
}
6259

6360
export default class QuestionModel {
@@ -85,7 +82,7 @@ export default class QuestionModel {
8582
this.content = null
8683
this.inline = false
8784
this.helpText = null
88-
this.link = []
85+
this.descriptionLink = []
8986

9087
Object.assign(this, options)
9188

0 commit comments

Comments
 (0)