diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-12-08 12:28:31 -0800 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-12-08 12:45:07 -0800 |
commit | 678bce09b58899d8689acf40946b9985db7a9ada (patch) | |
tree | 125e85845452d944f3a4b5590fc9ef6c27203c6b /lib/render-msg.js | |
parent | ef2fab24f57268bc2a96e74078855dfad047fd5b (diff) | |
download | patchfoo-678bce09b58899d8689acf40946b9985db7a9ada.tar.gz patchfoo-678bce09b58899d8689acf40946b9985db7a9ada.zip |
Render blog messages
Diffstat (limited to 'lib/render-msg.js')
-rw-r--r-- | lib/render-msg.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/render-msg.js b/lib/render-msg.js index 51db2a7..7d34fc3 100644 --- a/lib/render-msg.js +++ b/lib/render-msg.js @@ -275,6 +275,7 @@ RenderMsg.prototype.message = function (cb) { case 'macaco_maluco-sombrio-wall': return this.sombrioWall(cb) case 'macaco_maluco-sombrio-tombstone': return this.sombrioTombstone(cb) case 'macaco_maluco-sombrio-score': return this.sombrioScore(cb) + case 'blog': return this.blog(cb) default: return this.object(cb) } } @@ -1414,3 +1415,25 @@ RenderMsg.prototype.sombrioScore = function (cb) { h('ins', self.c.score) ), cb) } + +RenderMsg.prototype.blog = function (cb) { + var self = this + var blogId = u.linkDest(self.c.blog) + var imgId = u.linkDest(self.c.thumbnail) + var imgLink = imgId ? u.toLinkArray(self.c.mentions).filter(function (link) { + return link.link === imgId + })[0] || u.toLink(self.c.thumbnail) : null + self.wrapMini(h('table', h('tr', + h('td', + imgId ? h('img', { + src: self.render.imageUrl(imgId), + alt: (imgLink.name || '') + + (imgLink.size != null ? ' (' + self.render.formatSize(imgLink.size) + ')' : ''), + width: 180, + }) : 'blog'), + h('td', + blogId ? h('h3', h('a', {href: self.render.toUrl('/markdown/' + blogId)}, + self.c.title || self.msg.key)) : '', + self.c.summary || '') + )), cb) +} |