diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-02-28 23:51:01 -0500 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-03-01 01:50:31 -0500 |
commit | da7282dead4b8b9f339428aedbf0d882c5663dce (patch) | |
tree | 792fdec6ff5973b17f5da29ef816fe68f3029391 /lib | |
parent | aa81a0cc95f894b695fb2585d8dae18b086b6cfe (diff) | |
download | patchfoo-da7282dead4b8b9f339428aedbf0d882c5663dce.tar.gz patchfoo-da7282dead4b8b9f339428aedbf0d882c5663dce.zip |
Be able to dig any message
Diffstat (limited to 'lib')
-rw-r--r-- | lib/render-msg.js | 45 | ||||
-rw-r--r-- | lib/serve.js | 3 |
2 files changed, 30 insertions, 18 deletions
diff --git a/lib/render-msg.js b/lib/render-msg.js index 51d094e..1af0b34 100644 --- a/lib/render-msg.js +++ b/lib/render-msg.js @@ -92,8 +92,8 @@ RenderMsg.prototype.wrap = function (content, cb) { var self = this var channel = this.c.channel ? '#' + this.c.channel : '' var done = multicb({pluck: 1, spread: true}) - done()(null, h('tr.msg-row', - h('td.msg-left', + done()(null, [h('tr.msg-row', + h('td.msg-left', {rowspan: 2}, h('div', this.render.avatarImage(this.msg.value.author, done())), h('div', this.render.idLink(this.msg.value.author, done())), this.recpsLine(done()) @@ -107,20 +107,17 @@ RenderMsg.prototype.wrap = function (content, cb) { h('code', h('a.ssb-id', {href: this.toUrl(this.msg.key)}, this.msg.key)), channel ? [' ', h('a', {href: this.toUrl(channel)}, channel)] : ''), - this.issues(done()), - content), - h('td.msg-right', + this.issues(done())), + h('td.msg-right', h('form', {method: 'post', action: '/vote'}, this.msg.rel ? [this.msg.rel, ' '] : '', - this.msg.key ? h('form', {method: 'post', action: '/vote'}, - h('div', h('a', {href: this.toUrl(this.msg.key) + '?raw'}, 'raw')), - h('input', {type: 'hidden', name: 'recps', - value: this.recpsIds().join(',')}), - h('input', {type: 'hidden', name: 'link', value: this.msg.key}), - h('input', {type: 'hidden', name: 'value', value: 1}), - h('input', {type: 'submit', name: 'expression', value: 'dig'}) - ) : '' - ) - )) + this.msg.key ? [ + h('a', {href: this.toUrl(this.msg.key) + '?raw'}, 'raw'), ' ', + this.voteFormInner('dig') + ] : '' + )) + ), h('tr', + h('td.msg-content', {colspan: 2}, content) + )]) done(cb) } @@ -141,8 +138,13 @@ RenderMsg.prototype.wrapMini = function (content, cb) { href: this.msg.key ? this.toUrl(this.msg.key) : undefined }, htime(date)), ' ', content), - h('td.msg-right', - h('a', {href: this.toUrl(this.msg.key) + '?raw'}, 'raw')) + h('td.msg-right', h('form', {method: 'post', action: '/vote'}, + this.msg.rel ? [this.msg.rel, ' '] : '', + this.msg.key ? [ + h('a', {href: this.toUrl(this.msg.key) + '?raw'}, 'raw'), ' ', + this.voteFormInner('dig') + ] : '' + )) )) done(cb) } @@ -162,6 +164,15 @@ RenderMsg.prototype.recpsIds = function () { : [] } +RenderMsg.prototype.voteFormInner = function (expression) { + return [ + h('input', {type: 'hidden', name: 'recps', + value: this.recpsIds().join(',')}), + h('input', {type: 'hidden', name: 'link', value: this.msg.key}), + h('input', {type: 'hidden', name: 'value', value: 1}), + h('input', {type: 'submit', name: 'expression', value: expression})] +} + RenderMsg.prototype.message = function (raw, cb) { if (raw) return this.raw(cb) if (typeof this.c === 'string') return this.encrypted(cb) diff --git a/lib/serve.js b/lib/serve.js index 5386cbc..c2ac2ee 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -539,7 +539,7 @@ Serve.prototype.renderThreadPaginated = function (opts, feedId, q) { } function links(opts) { var limit = opts.limit || q.limit || 10 - return h('tr', h('td.paginate', {colspan: 2}, + return h('tr', h('td.paginate', {colspan: 3}, opts.forwards ? '↑ newer ' : '↓ older ', linkA(mergeOpts(opts, {limit: 1})), ' ', linkA(mergeOpts(opts, {limit: 10})), ' ', @@ -917,6 +917,7 @@ Serve.prototype.composer = function (opts, cb) { pull.once(msg), pull.asyncMap(self.app.unboxMsg), self.app.render.renderFeeds(raw), + pull.flatten(), pull.drain(function (el) { msgContainer.appendChild(el) }, cb) |