mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 11:48:08 +08:00
FIX: two-column poll
This commit is contained in:
@ -4,9 +4,6 @@ export default Em.Controller.extend({
|
||||
isRandom : Em.computed.equal("poll.order", "random"),
|
||||
isClosed: Em.computed.equal("poll.status", "closed"),
|
||||
|
||||
// immediately shows the results when the user has already voted
|
||||
showResults: Em.computed.gt("vote.length", 0),
|
||||
|
||||
// shows the results when
|
||||
// - poll is closed
|
||||
// - topic is archived/closed
|
||||
@ -50,6 +47,20 @@ export default Em.Controller.extend({
|
||||
return max;
|
||||
}.property("poll.max", "poll.options.length"),
|
||||
|
||||
votersText: function() {
|
||||
return I18n.t("poll.voters", { count: this.get("poll.voters") });
|
||||
}.property("poll.voters"),
|
||||
|
||||
totalVotes: function() {
|
||||
return _.reduce(this.get("poll.options"), function(total, o) {
|
||||
return total + parseInt(o.get("votes"), 10);
|
||||
}, 0);
|
||||
}.property("poll.options.@each.votes"),
|
||||
|
||||
totalVotesText: function() {
|
||||
return I18n.t("poll.total_votes", { count: this.get("totalVotes") });
|
||||
}.property("totalVotes"),
|
||||
|
||||
multipleHelpText: function() {
|
||||
const options = this.get("poll.options.length"),
|
||||
min = this.get("min"),
|
||||
|
Reference in New Issue
Block a user