mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 11:13:22 +08:00
UX: Highlight user's vote in polls.
This commit is contained in:
parent
e7564dc1d7
commit
1da6fc8e3c
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,7 +107,11 @@ div.poll {
|
|||
|
||||
.bar {
|
||||
height: 10px;
|
||||
background: $primary;
|
||||
background: dark-light-diff($primary, $secondary, 50%, -25%);;
|
||||
}
|
||||
|
||||
.chosen .bar {
|
||||
background: $tertiary;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user