Files: 98fd28641650bead5543428cdffb2bc932dbb165 / render.js
1990 bytesRaw
1 | var u = require('yap-util') |
2 | |
3 | module.exports = function (apply, gathering, context) { |
4 | var attending = {} |
5 | gathering.value.attendee.forEach(function (attendee) { |
6 | if(attendee.link) attending[attendee.link] = true |
7 | if(attendee.remove) delete attending[attendee.link] |
8 | }) |
9 | var gth = gathering.value |
10 | var start = gth.startDateTime && gth.startDateTime//.epoch |
11 | var epoch = start && start.epoch |
12 | var tz = start && start.tz |
13 | // console.log("START", gth.startDateTime) |
14 | return ['div.Gathering', |
15 | apply('avatar', {id: gathering.creator, name: true, image: true}),' ', |
16 | ['h1', |
17 | ['a', |
18 | {href: apply.toUrl('gatherings/event', {id:gathering.root, replies: true})}, |
19 | gth.title |
20 | ], |
21 | tz && '(tz: '+tz+')' |
22 | ], |
23 | ['h2', {title: tz}, new Date(epoch).toString()], |
24 | u.markdown({text:gth.description, mentions: gth.mentions}), |
25 | gathering.value.image |
26 | ? ['img', {href: 'http://localhost:8989/blobs/get/'+encodeURIComponent(gathering.value.image.link)}] |
27 | : '', |
28 | ['div.Attending', |
29 | 'attending:', |
30 | Object.keys(attending).map(function (id) { |
31 | return apply('avatar', id) |
32 | }) |
33 | ], |
34 | context.forms !== false && |
35 | apply('publish', { |
36 | id: context.id, |
37 | name: attending[context.id] ? "can't attend" : "attend", |
38 | content: { |
39 | type: 'about', |
40 | about: gathering.root, |
41 | root: gathering.root, |
42 | branch: gathering.branch, |
43 | attendee: { |
44 | link: context.id, |
45 | remove: attending[context.id] ? true : undefined |
46 | }, |
47 | } |
48 | }), |
49 | gathering.replies.length && |
50 | ['div.Replies', |
51 | gathering.replies.map(function (reply) { |
52 | return apply('messages/post', reply) |
53 | }), |
54 | context.forms !== false && apply('compose', { |
55 | content: { |
56 | type: 'post', |
57 | root: gathering.root, |
58 | // recps: recps, |
59 | branch: gathering.branch, |
60 | //channel: ary[0].value.content.channel |
61 | } |
62 | }) |
63 | |
64 | ] |
65 | ] |
66 | } |
67 | |
68 | |
69 | |
70 | |
71 | |
72 | |
73 | |
74 | |
75 | |
76 |
Built with git-ssb-web