aboutsummaryrefslogtreecommitdiff
path: root/lib/render-msg.js
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-05-30 14:04:54 -1000
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-05-30 14:04:54 -1000
commit7fdca5304e8322ddc09a35e4018e86984dde9ff4 (patch)
tree60aa1d2cacebae16e8beb68bcc48cab62fee0a4a /lib/render-msg.js
parentee7abb673cd0a592982e340d29ab64a3f4184eae (diff)
downloadpatchfoo-7fdca5304e8322ddc09a35e4018e86984dde9ff4.tar.gz
patchfoo-7fdca5304e8322ddc09a35e4018e86984dde9ff4.zip
Add attend button for gatherings
Diffstat (limited to 'lib/render-msg.js')
-rw-r--r--lib/render-msg.js29
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) {