-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.vue
138 lines (127 loc) · 2.8 KB
/
app.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<template>
<div>
<Html>
<Head>
<Title>Veeva Subject Line Calculator</Title>
<Meta name="description" content="Test subject line options for their proper length." />
</Head>
</Html>
<h1>Veeva Subject Line Calculator</h1>
<Fork />
<div class="subjects">
<div class="row" v-bind:key= "subject.id" v-for="subject in subjects">
<input v-model="subject.msg">
<span class="chars">{{subject.msg.length}}</span>
<button class="remove" @click="removeSubject(subject.id)">-</button>
</div>
<button class="add" @click="addSubject">+</button>
<p :class="{ error: characters > 1500}"><strong>Total Character Count:</strong> {{characters}} / 1500</p>
<textarea disabled v-model="token" />
<hr>
<p><strong>Common Veeva Tokens for use in subjects:</strong></p>
<ul>
<li><i>##accTitle##</i> - Inserts Account salutation</li>
<li><i>##accFname##</i> - Inserts Account first name</li>
<li><i>##accLname##</i> - Inserts Account last name</li>
<li><i>##userName##</i> - Inserts the rep’s name</li>
</ul>
</div>
</div>
</template>
<script>
export default {
data () {
return {
charsBase: 16,
n: 4,
subjects: [
{ id: 1, msg: 'Subject 1' },
{ id: 2, msg: 'Subject 2' },
{ id: 3, msg: 'Subject 3' }
]
}
},
computed: {
characters () {
return this.token.length
},
token () {
let s = this.subjects.map(function(subject) {
return subject['msg']
})
let token = s.join('|')
token = '{{customText[' + token + ']}}'
return token
}
},
methods: {
addSubject () {
this.n = this.n + 1;
this.subjects.push({ id: this.n, msg: 'New Subject' })
},
removeSubject (id) {
for (let i = 0; i < this.subjects.length; ++i) {
if (this.subjects[i].id === id) {
this.subjects.splice(i, 1)
break
}
}
}
}
}
</script>
<style>
body {
max-width: 650px;
display: flex;
flex-direction: column;
margin: 20px auto;
padding: 15px;
font-size: 18px;
line-height: 20px;
font-family: arial, sans-serif;
}
h1 {
font-size: 24px;
line-height: 26px;
}
input {
font-size: 18px;
line-height: 20px;
font-family: arial, sans-serif;
width: calc(100% - 50px);
}
textarea {
font-size: 18px;
line-height: 20px;
font-family: arial, sans-serif;
width: 100%;
height: 100px;
resize: none;
}
.subjects {
padding: 20px 0;
}
.row {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding-bottom: 15px;
}
.chars {
width: 45px;
text-align: center;
color: #666;
}
.remove {
width: 35px;
text-align: center;
}
.add {
width: 50px;
}
.error {
color: #E10000;
}
</style>