FEATURE: clean up badges admin

This commit is contained in:
Sam 2014-07-30 08:56:46 +10:00
parent ebf385aedc
commit 5c72297695
4 changed files with 8 additions and 5 deletions

View File

@ -6,7 +6,10 @@
{{#each}} {{#each}}
<li> <li>
<a {{action selectBadge this}} {{bind-attr class="selected:active"}}> <a {{action selectBadge this}} {{bind-attr class="selected:active"}}>
<span {{bind-attr class=":user-badge badgeTypeClassName" data-badge-name="name" title="displayDescription"}}>
<i {{bind-attr class=":fa icon"}}></i>
{{displayName}} {{displayName}}
</span>
{{#if newBadge}} {{#if newBadge}}
<span class="list-badge">{{i18n filters.new.lower_title}}</span> <span class="list-badge">{{i18n filters.new.lower_title}}</span>
{{/if}} {{/if}}

View File

@ -1,10 +1,6 @@
export default Ember.Component.extend({ export default Ember.Component.extend({
tagName: 'span', tagName: 'span',
badgeTypeClassName: function() {
return "badge-type-" + this.get('badge.badge_type.name').toLowerCase();
}.property('badge.badge_type.name'),
showGrantCount: function() { showGrantCount: function() {
return this.get('count') && this.get('count') > 1; return this.get('count') && this.get('count') > 1;
}.property('count'), }.property('count'),

View File

@ -99,6 +99,10 @@ Discourse.Badge = Discourse.Model.extend({
} }
}, },
badgeTypeClassName: function() {
return "badge-type-" + this.get('badge_type.name').toLowerCase();
}.property('badge_type.name'),
/** /**
Save and update the badge from the server's response. Save and update the badge from the server's response.

View File

@ -1,5 +1,5 @@
{{#link-to 'badges.show' badge}} {{#link-to 'badges.show' badge}}
<span {{bind-attr class=":user-badge badgeTypeClassName" data-badge-name="badge.name" title="badge.displayDescription"}}> <span {{bind-attr class=":user-badge badge.badgeTypeClassName" data-badge-name="badge.name" title="badge.displayDescription"}}>
{{#if isIcon}} {{#if isIcon}}
<i {{bind-attr class=":fa badge.icon"}}></i> <i {{bind-attr class=":fa badge.icon"}}></i>
{{else}} {{else}}