blob: 1a2b0fda3492178c89a0c0b574556b21c8c0bbf6 (
plain)
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
|
import Chat from './chat.js'
import LikeButton from './like-button.js'
import { Name } from './name.js'
export default {
data: ()=> ({
likeThreshold: 0,
channel: 'demo',
admin: null
}),
methods: {
messageObjects: Chat.methods.messageObjects,
likeObjects: LikeButton.methods.likeObjects,
},
template: `
<p>
Chat Channel: <input v-model="channel"/>
</p>
<graffiti-objects :tags="[channel]" v-slot="{objects}">
<p>
Only show me objects with more than <input v-model.number="likeThreshold"/> likes.
</p>
<ul v-for="object in messageObjects(objects)">
<graffiti-objects :tags="[object._id]" v-slot="{objects: responses}">
<li v-if="likeObjects(responses, object._id).length >= likeThreshold">
<em><Name :of="object._by"/></em>:
{{ object.message }}
</li>
</graffiti-objects>
</ul>
<p>
Only show me objects that
<select v-model="admin">
<option v-for="id in objects.authors" :value="id">
<Name :of="id">
</option>
</select>
has liked.
</p>
<ul v-for="object in messageObjects(objects)">
<graffiti-objects :tags="[object._id]" v-slot="{objects: responses}">
<li v-if="likeObjects(responses, object._id).filter(o=> o._by=admin).length">
<em><Name :of="object._by"/></em>:
{{ object.message }}
</li>
</graffiti-objects>
</ul>
</graffiti-objects>`
}
|