|
43 | 43 | <span |
44 | 44 | class="tooltip-target" |
45 | 45 | v-tooltip="filterVisible ? 'hide' : 'show all filters'" |
46 | | - @click="toggleFilters"> |
47 | | - <font-awesome-icon v-if="filterVisible" |
48 | | - icon="times-circle" class="icon"> |
49 | | - </font-awesome-icon> |
50 | | - <font-awesome-icon v-else icon="search-plus" class="icon"> |
51 | | - </font-awesome-icon> |
| 46 | + @click="onToggleFilters"> |
| 47 | + <font-awesome-icon v-if="filterVisible" icon="times-circle" class="icon"></font-awesome-icon> |
| 48 | + <font-awesome-icon v-else icon="filter" class="icon"></font-awesome-icon> |
52 | 49 | </span> |
53 | 50 | <template slot="popover"> |
54 | 51 | <div class="filter-options"> |
|
70 | 67 | </div> |
71 | 68 | </div> |
72 | 69 | <div class="title">Max. # of threads</div> |
73 | | - <div> |
| 70 | + <div> |
| 71 | + <input |
| 72 | + type="number" |
| 73 | + id="max-threads" |
| 74 | + placeholder="n/a" |
| 75 | + min="0" |
| 76 | + v-model="maxThreads" |
| 77 | + @keypress="event => validateNumber(event)" |
| 78 | + @change="onFilterChange('max-threads')"> |
| 79 | + </div> |
| 80 | + <div class="title">{{currentConfigs.isExpClass ? `Looking for Classmates' Perspectives` : 'Upvotes'}}</div> |
| 81 | + <div class="upvotes"> |
| 82 | + <div> |
74 | 83 | <input |
75 | | - type="number" |
76 | | - id="max-threads" |
77 | | - placeholder="n/a" |
78 | | - min="0" |
79 | | - v-model="maxThreads" |
80 | | - @keypress="event => validateNumber(event)" |
81 | | - @change="onFilterChange('max-threads')"> |
| 84 | + type="checkbox" |
| 85 | + id="anyone-upvotes" |
| 86 | + value="anyone" |
| 87 | + v-model="filterUpvotes" |
| 88 | + @change="onFilterChange('upvotes')"> |
| 89 | + <label for="anyone-upvotes"> |
| 90 | + anyone |
| 91 | + </label> |
| 92 | + </div> |
| 93 | + <div> |
| 94 | + <input |
| 95 | + type="checkbox" |
| 96 | + id="my-upvotes" |
| 97 | + value="me" |
| 98 | + v-model="filterUpvotes" |
| 99 | + @change="onFilterChange('upvotes')"> |
| 100 | + <label for="my-upvotes"> |
| 101 | + me |
| 102 | + </label> |
82 | 103 | </div> |
| 104 | + </div> |
83 | 105 | <div class="title">Users tagged</div> |
84 | 106 | <div class="user-tags"> |
85 | 107 | <div> |
|
166 | 188 | </label> |
167 | 189 | </div> |
168 | 190 | </div> |
169 | | - <div class="title">{{currentConfigs.isExpClass ? 'Discussion comments' : 'Upvotes'}}</div> |
170 | | - <div class="upvotes"> |
171 | | - <div> |
172 | | - <input |
173 | | - type="checkbox" |
174 | | - id="anyone-upvotes" |
175 | | - value="anyone" |
176 | | - v-model="filterUpvotes" |
177 | | - @change="onFilterChange('upvotes')"> |
178 | | - <label for="anyone-upvotes"> |
179 | | - anyone |
180 | | - </label> |
181 | | - </div> |
182 | | - <div> |
183 | | - <input |
184 | | - type="checkbox" |
185 | | - id="my-upvotes" |
186 | | - value="me" |
187 | | - v-model="filterUpvotes" |
188 | | - @change="onFilterChange('upvotes')"> |
189 | | - <label for="my-upvotes"> |
190 | | - me |
191 | | - </label> |
192 | | - </div> |
193 | | - </div> |
| 191 | + |
194 | 192 | <div class="title"> |
195 | 193 | Others |
196 | 194 | </div> |
@@ -424,12 +422,15 @@ export default { |
424 | 422 | users: Array, |
425 | 423 | hashtags: Array, |
426 | 424 | syncConfig: Boolean, |
| 425 | + filterVisible: { |
| 426 | + type: Boolean, |
| 427 | + default: false |
| 428 | + }, |
427 | 429 | filter: Object, |
428 | 430 | currentConfigs: Object, |
429 | 431 | }, |
430 | 432 | data () { |
431 | 433 | return { |
432 | | - filterVisible: false, |
433 | 434 | filterBookmarks: false, |
434 | 435 | filterHashtags: [], |
435 | 436 | filterUserTags: [], |
@@ -459,7 +460,7 @@ export default { |
459 | 460 | if (this.filter.maxThreads !== this.maxThreads) { |
460 | 461 | this.maxThreads = this.filter.maxThreads |
461 | 462 | } |
462 | | - } |
| 463 | + }, |
463 | 464 | }, |
464 | 465 | computed: { |
465 | 466 | currentMaxThread: function() { |
@@ -503,11 +504,11 @@ export default { |
503 | 504 | this.filterBookmarks = !this.filterBookmarks |
504 | 505 | this.onFilterChange('bookmarks') |
505 | 506 | }, |
506 | | - toggleFilters: function (event) { |
507 | | - this.filterVisible = !this.filterVisible |
508 | | - }, |
509 | 507 | onFilterHide: function () { |
510 | | - this.filterVisible = false |
| 508 | + this.$emit('filter-hide') |
| 509 | + }, |
| 510 | + onToggleFilters: function () { |
| 511 | + this.$emit('toggle-filters') |
511 | 512 | }, |
512 | 513 | onFilterChange: function (type) { |
513 | 514 | switch (type) { |
|
0 commit comments