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> <ul>
{{#each group in controller}} {{#each group in controller}}
<li> <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> </li>
{{/each}} {{/each}}
</ul> </ul>

View file

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