1
1
<template >
2
2
<div class =" polls" id =" poll-view" v-if =" poll" >
3
3
<!-- Poll Header -->
4
- <div class =" poll-title" >
4
+ <div class =" poll-title collapse-section " @click = " togglePollsCollapsed() " >
5
5
<span class =" poll-title-text" >
6
+ <a :class =" { 'is-open': !options.polls_collapsed, 'is-closed': options.polls_collapsed }" >
7
+ <svg xmlns =" http://www.w3.org/2000/svg" viewBox =" 0 0 39.84 22.63" class =" icon__caretDown" >
8
+ <title ></title >
9
+ <g id =" Layer_2" data-name =" Layer 2" >
10
+ <polyline class =" icon" points =" 37.92 1.92 19.92 19.92 1.92 1.92" />
11
+ </g >
12
+ </svg >
13
+ </a >
6
14
Poll
7
15
<span class =" is_locked" v-if =" pollCopy.locked" >(Locked)</span >
8
16
</span >
9
- <div class =" poll-controls" >
17
+ <div v-if = " !options.polls_collapsed " class =" poll-controls" >
10
18
<!-- Poll Controls -->
11
19
<div class =" poll-control" v-if =" canLock()" >
12
20
<input id =" lockPoll" class =" icon" type =" checkbox" v-model =" pollCopy.locked" >
32
40
</div >
33
41
34
42
<!-- Poll Edit -->
35
- <div class =" poll-edit" v-if =" canEdit()" :class =" {'showing': editPoll, 'hidden': !editPoll}" >
43
+ <div class =" poll-edit" v-if =" canEdit() && !options.polls_collapsed " :class =" {'showing': editPoll, 'hidden': !editPoll}" >
36
44
<div class =" slide-wrapper" >
37
45
<div class =" poll-edit-container" >
38
46
<h5 class =" panelTitle" >Edit Poll Options:</h5 >
71
79
</div >
72
80
</div >
73
81
74
- <div class =" poll-body" >
82
+ <div v-if = " !options.polls_collapsed " class =" poll-body" >
75
83
<div class =" poll-header" >
76
84
<!-- Poll Details -->
77
85
<div class =" poll-header-main" >
117
125
</div >
118
126
</div >
119
127
</div >
120
- <div class =" actionsBar" >
128
+ <div v-if = " !options.polls_collapsed " class =" actionsBar" >
121
129
<button @click =" vote()" :disabled =" pollAnswers.length === 0" v-if =" canVote()" >Vote</button >
122
130
<button v-if =" canRemoveVote()" @click =" removeVote()" class =" secondary" >Remove Vote</button >
123
131
</div >
@@ -288,6 +296,11 @@ export default {
288
296
console .log (' scrollPollView' )
289
297
// $('#poll-view').animate({ scrollTop: 0 }, 250)
290
298
}
299
+
300
+ const togglePollsCollapsed = () => {
301
+ v .options .polls_collapsed = ! v .options .polls_collapsed
302
+ }
303
+
291
304
/* Internal Data */
292
305
const $auth = inject (AuthStore)
293
306
const $alertStore = inject (' $alertStore' )
@@ -303,7 +316,8 @@ export default {
303
316
display_mode: props .poll .display_mode ,
304
317
// used in view to track date and time from input field
305
318
expiration_date: props .poll .expiration ? dayjs (props .poll .expiration ).format (' YYYY-MM-DD' ) : undefined ,
306
- expiration_time: props .poll .expiration ? dayjs (props .poll .expiration ).format (' HH:mm' ) : undefined
319
+ expiration_time: props .poll .expiration ? dayjs (props .poll .expiration ).format (' HH:mm' ) : undefined ,
320
+ polls_collapsed: false
307
321
},
308
322
editPoll: false ,
309
323
pollAnswers: [],
@@ -334,7 +348,8 @@ export default {
334
348
updateLockPoll,
335
349
calcExpiration,
336
350
scrollPollView,
337
- humanDate
351
+ humanDate,
352
+ togglePollsCollapsed
338
353
}
339
354
}
340
355
}
@@ -351,4 +366,34 @@ export default {
351
366
max-height : 0rem ;
352
367
}
353
368
}
369
+
370
+ .collapse-section {
371
+ @include no-select ;
372
+ cursor : pointer ;
373
+ a { margin-left : -0.5rem ; }
374
+ .title { display : inline-block ; margin-left : .5rem ; }
375
+ .is-open {
376
+ .icon__caretDown {
377
+ transform : rotateZ (0deg );
378
+ transition : all ease-in-out 150ms ;
379
+ }
380
+ }
381
+ .is-closed {
382
+ .icon__caretDown {
383
+ transform : rotateZ (-90deg );
384
+ transition : all ease-in-out 150ms ;
385
+ }
386
+ }
387
+ .icon__caretDown {
388
+ margin-bottom : 3px ;
389
+ width : 8px ;
390
+ polyline {
391
+ fill : none ;
392
+ stroke : $secondary-font-color ;
393
+ stroke-linecap : round ;
394
+ stroke-miterlimit : 10 ;
395
+ stroke-width : 7px ;
396
+ }
397
+ }
398
+ }
354
399
</style >
0 commit comments