we were forced to bind here

This commit is contained in:
Sam 2015-02-06 16:46:28 +11:00
parent dd9c23eb5e
commit ab25ddcc3b
2 changed files with 17 additions and 1 deletions

View File

@ -41,6 +41,22 @@ export default Ember.Component.extend({
return result; return result;
}.property('category'), }.property('category'),
categoryColor: function() {
var category = this.get('category');
if (category) {
var color = get(category, 'color');
if (color) {
var style = "";
if (color) { style += "background-color: #" + color + ";" }
return style;
}
}
return "background-color: #eee;";
}.property('category'),
badgeStyle: function() { badgeStyle: function() {
var category = this.get('category'); var category = this.get('category');

View File

@ -1,6 +1,6 @@
{{#if category}} {{#if category}}
<a href {{action "expand"}} class="badge-category" {{bind-attr style="badgeStyle"}}> <a href {{action "expand"}} class="badge-category" {{bind-attr style="badgeStyle"}}>
<span class="badge-category-bg" style="background-color: #{{unbound category.color}};"></span> <span class="badge-category-bg" {{bind-attr style="categoryColor"}}></span>
{{#if category.read_restricted}} {{#if category.read_restricted}}
{{fa-icon "lock"}} {{fa-icon "lock"}}
{{/if}} {{/if}}