diff --git a/app/assets/javascripts/discourse/controllers/badges/show.js.es6 b/app/assets/javascripts/discourse/controllers/badges/show.js.es6 index 9ccd077be0d..27856754bdd 100644 --- a/app/assets/javascripts/discourse/controllers/badges/show.js.es6 +++ b/app/assets/javascripts/discourse/controllers/badges/show.js.es6 @@ -10,13 +10,11 @@ export default Discourse.ObjectController.extend({ grantDates: Em.computed.mapBy('userBadges', 'grantedAt'), minGrantedAt: Em.computed.min('grantDates'), - moreUserCount: function() { + canLoadMore: function() { if (this.get('userBadges')) { - return this.get('model.grant_count') - this.get('userBadges.length'); + return this.get('model.grant_count') > this.get('userBadges.length'); } else { - return 0; + return false; } - }.property('model.grant_count', 'userBadges.length'), - - showMoreUsers: Em.computed.gt('moreUserCount', 0) + }.property('model.grant_count', 'userBadges.length') }); diff --git a/app/assets/javascripts/discourse/templates/badges/show.js.handlebars b/app/assets/javascripts/discourse/templates/badges/show.js.handlebars index 5949c35d8b3..26f7a090611 100644 --- a/app/assets/javascripts/discourse/templates/badges/show.js.handlebars +++ b/app/assets/javascripts/discourse/templates/badges/show.js.handlebars @@ -27,10 +27,8 @@ {{/link-to}} {{/each}} - {{#if showMoreUsers}} - + {{#if canLoadMore}} +
{{i18n loading}}
{{/if}} {{else}} {{#unless userBadgesLoaded}} diff --git a/app/assets/javascripts/discourse/views/badges_show_view.js b/app/assets/javascripts/discourse/views/badges_show_view.js new file mode 100644 index 00000000000..7534e62bba2 --- /dev/null +++ b/app/assets/javascripts/discourse/views/badges_show_view.js @@ -0,0 +1,11 @@ +/** + View for showing a particular badge. + + @class BadgesShowView + @extends Discourse.View + @namespace Discourse + @module Discourse +**/ +Discourse.BadgesShowView = Discourse.View.extend(Discourse.LoadMore, { + eyelineSelector: '.badge-user' +});