git ssb

7+

dinoworm 🐛 / patchcore



Commit 6bb2ee8132fe243c45b55f4da55306f14d7c0f5a

basic rendering of issues

Matt McKegg committed on 2/20/2017, 4:06:13 AM
Parent: 9948227317043fdb89ba84d455ae0c8a28413879

Files changed

message/html/render/issue.jsadded
message/html/render/issue.jsView
@@ -1,0 +1,31 @@
1 +var h = require('mutant/h')
2 +var nest = require('depnest')
3 +var extend = require('xtend')
4 +
5 +exports.needs = nest({
6 + 'message.html': {
7 + decorate: 'reduce',
8 + layout: 'first',
9 + link: 'first',
10 + markdown: 'first'
11 + }
12 +})
13 +
14 +exports.gives = nest('message.html.render')
15 +
16 +exports.create = function (api) {
17 + return nest('message.html.render', function renderMessage (msg, opts) {
18 + if (msg.value.content.type !== 'issue') return
19 + var element = api.message.html.layout(msg, extend({
20 + content: messageContent(msg),
21 + layout: 'default'
22 + }, opts))
23 +
24 + return api.message.html.decorate(element, { msg })
25 + })
26 +
27 + function messageContent (data) {
28 + if (!data.value.content || !data.value.content.text) return
29 + return h('div', {}, api.message.html.markdown(data.value.content))
30 + }
31 +}

Built with git-ssb-web