This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/controllers/badges_show_controller.js
2014-05-05 13:58:57 -04:00

23 lines
630 B
JavaScript

/**
Controller for showing a particular badge.
@class BadgesShowController
@extends Discourse.ObjectController
@namespace Discourse
@module Discourse
**/
Discourse.BadgesShowController = Discourse.ObjectController.extend({
grantDates: Em.computed.mapBy('userBadges', 'grantedAt'),
minGrantedAt: Em.computed.min('grantDates'),
moreUserCount: function() {
if (this.get('userBadges')) {
return this.get('model.grant_count') - this.get('userBadges.length');
} else {
return 0;
}
}.property('model.grant_count', 'userBadges.length'),
showMoreUsers: Em.computed.gt('moreUserCount', 0)
});