2014-03-05 07:52:20 -05:00
|
|
|
/**
|
|
|
|
This is the itemController for `Discourse.AdminBadgesController`. Its main purpose
|
|
|
|
is to indicate which badge was selected.
|
|
|
|
|
|
|
|
@class AdminBadgeController
|
|
|
|
@extends Discourse.ObjectController
|
|
|
|
@namespace Discourse
|
|
|
|
@module Discourse
|
|
|
|
**/
|
|
|
|
|
2014-06-09 21:23:18 -04:00
|
|
|
var RESERVED_BADGE_COUNT = 100;
|
|
|
|
|
2014-03-05 07:52:20 -05:00
|
|
|
Discourse.AdminBadgeController = Discourse.ObjectController.extend({
|
|
|
|
/**
|
|
|
|
Whether this badge has been selected.
|
|
|
|
|
|
|
|
@property selected
|
|
|
|
@type {Boolean}
|
|
|
|
**/
|
2014-05-19 00:29:12 -04:00
|
|
|
selected: Discourse.computed.propertyEqual('model.name', 'parentController.selectedItem.name'),
|
|
|
|
|
|
|
|
/**
|
|
|
|
Show the displayName only if it is different from the name.
|
|
|
|
|
|
|
|
@property showDisplayName
|
|
|
|
@type {Boolean}
|
|
|
|
**/
|
|
|
|
showDisplayName: Discourse.computed.propertyNotEqual('selectedItem.name', 'selectedItem.displayName'),
|
|
|
|
|
|
|
|
/**
|
|
|
|
Don't allow editing if this is a system badge.
|
|
|
|
|
|
|
|
@property readOnly
|
|
|
|
@type {Boolean}
|
|
|
|
**/
|
2014-06-09 21:23:18 -04:00
|
|
|
readOnly: Ember.computed.lt('model.id', RESERVED_BADGE_COUNT)
|
2014-03-05 07:52:20 -05:00
|
|
|
});
|