module.exports = function (apply, gathering) { var attending = {} gathering.value.attendee.forEach(function (attendee) { if(attendee.link) attending[attendee.link] = true if(attendee.remove) delete attending[attendee.link] }) var gth = gathering.value var epoch = gth.startDateTime && gth.startDateTime.epoch var tz = epoch && epoch.tz return ['div.Gathering', apply('avatar', {id: gathering.creator, name: true, image: true}),' ', ['h1', ['a', {href: apply.toUrl('gatherings/event', {id:gathering.root})}, gth.title ] ], ['h2', {title: tz}, new Date(epoch).toString()], ['p', gathering.value.description], gathering.value.image ? ['img', {href: 'http://localhost:8989/blobs/get/'+encodeURIComponent(gathering.value.image.link)}] : '', ['div.Attending', 'attending:', Object.keys(attending).map(function (id) { return apply('avatar', id) }) ] ] }