mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
Upgrade polls to Ember 1.11
This commit is contained in:
parent
2e4d43364a
commit
585583d38c
4 changed files with 7 additions and 11 deletions
|
@ -12,7 +12,8 @@ export default Em.Component.extend({
|
||||||
var styles = [];
|
var styles = [];
|
||||||
if (this.get("color")) { styles.push("color:" + this.get("color")); }
|
if (this.get("color")) { styles.push("color:" + this.get("color")); }
|
||||||
if (this.get("background")) { styles.push("background:" + this.get("background")); }
|
if (this.get("background")) { styles.push("background:" + this.get("background")); }
|
||||||
return styles.length > 0 ? styles.join(";") : false;
|
|
||||||
|
return (styles.length > 0 ? styles.join(";") : '').htmlSafe();
|
||||||
}.property("color", "background"),
|
}.property("color", "background"),
|
||||||
|
|
||||||
render(buffer) {
|
render(buffer) {
|
||||||
|
|
|
@ -13,9 +13,9 @@ export default Em.Component.extend({
|
||||||
if (backgroundColor) { styles.push("background: " + backgroundColor); }
|
if (backgroundColor) { styles.push("background: " + backgroundColor); }
|
||||||
|
|
||||||
option.setProperties({
|
option.setProperties({
|
||||||
percentage: percentage,
|
percentage,
|
||||||
title: I18n.t("poll.option_title", { count: option.get("votes") }),
|
title: I18n.t("poll.option_title", { count: option.get("votes") }),
|
||||||
style: styles.join(";")
|
style: styles.join(";").htmlSafe()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" class="bar-back">
|
<td colspan="2" class="bar-back">
|
||||||
<div class="bar" {{bind-attr style=option.style}}></div>
|
<div class="bar" style={{option.style}}></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
|
@ -5,12 +5,7 @@ function createPollView(container, post, poll, vote) {
|
||||||
view = container.lookup("view:poll");
|
view = container.lookup("view:poll");
|
||||||
|
|
||||||
controller.set("vote", vote);
|
controller.set("vote", vote);
|
||||||
|
controller.setProperties({ model: Em.Object.create(poll), post });
|
||||||
controller.setProperties({
|
|
||||||
model: Em.Object.create(poll),
|
|
||||||
post: post,
|
|
||||||
});
|
|
||||||
|
|
||||||
view.set("controller", controller);
|
view.set("controller", controller);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
|
@ -53,7 +48,7 @@ export default {
|
||||||
pollView = createPollView(container, post, polls[pollName], votes[pollName]);
|
pollView = createPollView(container, post, polls[pollName], votes[pollName]);
|
||||||
|
|
||||||
$poll.replaceWith($div);
|
$poll.replaceWith($div);
|
||||||
pollView.constructor.renderer.replaceIn(pollView, $div[0]);
|
pollView.renderer.replaceIn(pollView, $div[0]);
|
||||||
pollViews[pollName] = pollView;
|
pollViews[pollName] = pollView;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue