mirror of
https://github.com/discourse/discourse.git
synced 2025-04-17 01:09:03 +08:00
ooops, we actually need that :fired:
This commit is contained in:
parent
a3fb2c002c
commit
42be2b431f
plugins/poll/assets/javascripts
@ -6,10 +6,12 @@ export default Em.Component.extend({
|
|||||||
const voters = this.get("poll.voters");
|
const voters = this.get("poll.voters");
|
||||||
|
|
||||||
this.get("poll.options").forEach(option => {
|
this.get("poll.options").forEach(option => {
|
||||||
const percentage = voters === 0 ? 0 : Math.floor(100 * option.get("votes") / voters);
|
const percentage = voters === 0 ? 0 : Math.floor(100 * option.get("votes") / voters),
|
||||||
|
style = "width: " + percentage + "%".htmlSafe();
|
||||||
|
|
||||||
option.setProperties({
|
option.setProperties({
|
||||||
percentage,
|
percentage,
|
||||||
|
style,
|
||||||
title: I18n.t("poll.option_title", { count: option.get("votes") })
|
title: I18n.t("poll.option_title", { count: option.get("votes") })
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" class="bar-back">
|
<td colspan="2" class="bar-back">
|
||||||
<div class="bar"></div>
|
<div class="bar" style={{option.style}}></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user