UX: Don't display span if there is no count.

This commit is contained in:
Guo Xiang Tan 2016-02-19 15:32:10 +08:00
parent ecca7b69bb
commit 4858187b0e
2 changed files with 9 additions and 5 deletions

View file

@ -4,7 +4,11 @@
<ul>
{{#each group in controller}}
<li>
{{#link-to "adminGroup" group.type group.name}}{{group.name}} <span class="count">{{group.userCountDisplay}}</span>{{/link-to}}
{{#link-to "adminGroup" group.type group.name}}{{group.name}}
{{#if group.userCountDisplay}}
<span class="count">{{group.userCountDisplay}}</span>
{{/if}}
{{/link-to}}
</li>
{{/each}}
</ul>

View file

@ -17,11 +17,11 @@ const Group = Discourse.Model.extend({
return this.get("automatic") ? "automatic" : "custom";
}.property("automatic"),
userCountDisplay: function(){
var c = this.get('user_count');
@computed('user_count')
userCountDisplay(userCount) {
// don't display zero its ugly
if (c > 0) { return c; }
}.property('user_count'),
if (userCount > 0) { return userCount; }
},
findMembers() {
if (Em.isEmpty(this.get('name'))) { return ; }