mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 04:08:41 +08:00
- FEATURE: revamped poll plugin
- add User.staff scope - inject MessageBus into Ember views (so it can be used by the poll plugin) - REFACTOR: use more accurate is_first_post? method instead of post_number == 1 - FEATURE: add support for JSON-typed custom fields - FEATURE: allow plugins to add validation - FEATURE: add post_custom_fields to PostSerializer - FEATURE: allow plugins to whitelist post_custom_fields - FIX: don't bump when post did not save successfully - FEATURE: polls are supported in any post - FEATURE: allow for multiple polls in the same post - FEATURE: multiple choice polls - FEATURE: rating polls - FEATURE: new dialect allowing users to preview polls in the composer
This commit is contained in:
@ -0,0 +1,28 @@
|
||||
export default Em.Component.extend({
|
||||
tagName: "li",
|
||||
attributeBindings: ["data-poll-option-id", "data-poll-selected", "style"],
|
||||
|
||||
"data-poll-option-id": Em.computed.alias("option.id"),
|
||||
|
||||
"data-poll-selected": function() {
|
||||
return this.get("option.selected") ? "selected" : false;
|
||||
}.property("option.selected"),
|
||||
|
||||
style: function() {
|
||||
var styles = [];
|
||||
if (this.get("color")) { styles.push("color:" + this.get("color")); }
|
||||
if (this.get("background")) { styles.push("background:" + this.get("background")); }
|
||||
return styles.length > 0 ? styles.join(";") : false;
|
||||
}.property("color", "background"),
|
||||
|
||||
render(buffer) {
|
||||
buffer.push(this.get("option.html"));
|
||||
},
|
||||
|
||||
click(e) {
|
||||
// ensure we're not clicking on a link
|
||||
if ($(e.target).closest("a").length === 0) {
|
||||
this.sendAction("toggle", this.get("option"));
|
||||
}
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user