aboutsummaryrefslogtreecommitdiff
path: root/lib/render-msg.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/render-msg.js')
-rw-r--r--lib/render-msg.js26
1 files changed, 16 insertions, 10 deletions
diff --git a/lib/render-msg.js b/lib/render-msg.js
index 91e7386..cda8eab 100644
--- a/lib/render-msg.js
+++ b/lib/render-msg.js
@@ -1747,23 +1747,29 @@ RenderMsg.prototype.poll = function (cb) {
return self.wrap(h('div',
h('h3', {innerHTML: unwrapP(self.render.markdown(self.c.title))}),
h('div', {innerHTML: unwrapP(self.render.markdown(self.c.body, self.c.mentions))}),
+ h('p', 'closes at: ', h('span', {
+ title: closeDate.toLocaleString()
+ }, closeDate.toString())),
details.type === 'chooseOne' ? h('form', {method: 'post', action: ''},
+ h('p', 'Choose one'),
h('input', {type: 'hidden', name: 'action', value: 'poll-position'}),
h('input', {type: 'hidden', name: 'poll_root', value: self.msg.key}),
h('input', {type: 'hidden', name: 'poll_type', value: 'chooseOne'}),
- choices.map(function (choice) {
- return [h('input', {type: 'submit', name: 'poll_choice', value: choice}), ' ']
- })
- ) : h('div', 'unknown poll type'),
- h('p', 'closes at: ', h('span', {
- title: closeDate.toLocaleString()
- }, closeDate.toString()))
+ choices.map(function (choice, i) {
+ return h('div',
+ h('input', {type: 'radio', name: 'poll_choice', value: i}), ' ', String(choice))
+ }),
+ h('p', 'reason: ',
+ h('div', h('textarea', {name: 'poll_reason'}))
+ ),
+ h('p', h('input', {type: 'submit', value: 'preview publish position'}))
+ ) : h('div', 'unknown poll type')
), cb)
}
RenderMsg.prototype.pollPosition = function (cb) {
var self = this
- var details = self.c.pollDetails || self.c.details || {}
+ var details = self.c.pollDetails || self.c.details || self.c
var reason = self.c.reason || ''
var done = multicb({pluck: 1, spread: true})
self.link(self.c.root, done())
@@ -1776,9 +1782,9 @@ RenderMsg.prototype.pollPosition = function (cb) {
done(function (err, rootLink, branchLinks, rootMsg) {
if (err) return cb(err)
var rootContent = rootMsg && rootMsg.value.content || {}
- var rootDetails = rootContent.pollDetails || rootContent.details || {}
+ var rootDetails = rootContent.pollDetails || rootContent.details || rootContent
var choices = u.toArray(rootDetails.choices)
- var choice = details.choice && choices && choices[details.choice]
+ var choice = details.choice != null && choices && choices[details.choice]
return self.wrap(h('div',
rootLink ? h('div', h('small', h('span.symbol', '→'), ' ', rootLink)) : '',
branchLinks.map(function (a, i) {