mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
UX: Highlight user's vote in polls.
This commit is contained in:
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user