diff options
Diffstat (limited to 'lib/render-msg.js')
-rw-r--r-- | lib/render-msg.js | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/lib/render-msg.js b/lib/render-msg.js index 5b32fdd..003c1bf 100644 --- a/lib/render-msg.js +++ b/lib/render-msg.js @@ -148,7 +148,9 @@ RenderMsg.prototype.actions = function () { this.c.type === 'gathering' ? [ h('a', {href: this.render.toUrl('/about/' + encodeURIComponent(this.msg.key))}, 'about'), ' '] : '', h('a', {href: this.toUrl(this.msg.key) + '?raw'}, 'raw'), ' ', - this.voteFormInner('dig') + this.buttonsCommon(), + this.c.type === 'gathering' ? [this.attendButton(), ' '] : '', + this.voteButton('dig') ) : [ this.msg.rel ? [this.msg.rel, ' '] : '' ] @@ -175,16 +177,29 @@ RenderMsg.prototype.recpsIds = function () { : [] } -RenderMsg.prototype.voteFormInner = function (expression) { +RenderMsg.prototype.buttonsCommon = function () { var chan = this.msg.value.content.channel + var recps = this.recpsIds() return [ - h('input', {type: 'hidden', name: 'action', value: 'vote'}), - h('input', {type: 'hidden', name: 'recps', - value: this.recpsIds().join(',')}), chan ? h('input', {type: 'hidden', name: 'channel', value: chan}) : '', 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})] + h('input', {type: 'hidden', name: 'recps', value: recps.join(',')}) + ] +} + +RenderMsg.prototype.voteButton = function (expression) { + var chan = this.msg.value.content.channel + return [ + h('input', {type: 'hidden', name: 'vote_value', value: 1}), + h('input', {type: 'hidden', name: 'vote_expression', value: expression}), + h('input', {type: 'submit', name: 'action_vote', value: expression})] +} + +RenderMsg.prototype.attendButton = function () { + var chan = this.msg.value.content.channel + return [ + h('input', {type: 'submit', name: 'action_attend', value: 'attend'}) + ] } RenderMsg.prototype.message = function (cb) { |