UX: Highlight user's vote in polls.

This commit is contained in:
Guo Xiang Tan
2017-01-25 11:56:39 +08:00
parent e7564dc1d7
commit 1da6fc8e3c
2 changed files with 8 additions and 3 deletions

View File

@ -160,8 +160,9 @@ createWidget('discourse-poll-standard-results', {
return ordered.map((option, idx) => {
const contents = [];
const per = rounded[idx].toString();
const chosen = attrs.vote.includes(option.id);
contents.push(h('div.option',
h('p', [ h('span.percentage', `${per}%`), optionHtml(option) ])
));
@ -178,7 +179,7 @@ createWidget('discourse-poll-standard-results', {
}));
}
return h('li', contents);
return h('li', { className: `${chosen ? 'chosen' : ''}` }, contents);
});
}
}