diff --git a/app/assets/javascripts/admin/controllers/admin_badges_controller.js b/app/assets/javascripts/admin/controllers/admin_badges_controller.js index c41479ca5bd..9ec65709a2b 100644 --- a/app/assets/javascripts/admin/controllers/admin_badges_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_badges_controller.js @@ -8,6 +8,15 @@ **/ Discourse.AdminBadgesController = Ember.ArrayController.extend({ itemController: 'adminBadge', + queryParams: ['badgeId'], + + /** + ID of the currently selected badge. + + @property badgeId + @type {Integer} + **/ + badgeId: Em.computed.alias('selectedItem.id'), /** We don't allow setting a description if a translation for the given badge @@ -68,6 +77,13 @@ Discourse.AdminBadgesController = Ember.ArrayController.extend({ @method destroy **/ destroy: function() { + // Delete immediately if the selected badge is new. + if (!this.get('selectedItem.id')) { + this.get('model').removeObject(this.get('selectedItem')); + this.set('selectedItem', null); + return; + } + var self = this; return bootbox.confirm(I18n.t("admin.badges.delete_confirm"), I18n.t("no_value"), I18n.t("yes_value"), function(result) { if (result) { diff --git a/app/assets/javascripts/admin/templates/badges.js.handlebars b/app/assets/javascripts/admin/templates/badges.js.handlebars index e888b2d8961..6b1b513c023 100644 --- a/app/assets/javascripts/admin/templates/badges.js.handlebars +++ b/app/assets/javascripts/admin/templates/badges.js.handlebars @@ -8,7 +8,7 @@ {{displayName}} {{#if newBadge}} - ({{i18n filters.new.lower_title}}) + {{i18n filters.new.lower_title}} {{/if}} @@ -51,14 +51,14 @@ {{/if}} - {{#unless readOnly}} -
- - {{input type="checkbox" checked=allow_title}} - {{i18n admin.badges.allow_title}} - -
+
+ + {{input type="checkbox" checked=allow_title disabled=readOnly}} + {{i18n admin.badges.allow_title}} + +
+ {{#unless readOnly}}
{{savingStatus}} diff --git a/app/assets/stylesheets/common/admin/admin_base.scss b/app/assets/stylesheets/common/admin/admin_base.scss index a720a0f4574..2b24c3e26eb 100644 --- a/app/assets/stylesheets/common/admin/admin_base.scss +++ b/app/assets/stylesheets/common/admin/admin_base.scss @@ -326,6 +326,16 @@ section.details { .badges { .content-list ul { margin-bottom: 10px; + + .list-badge { + float: right; + font-size: 11px; + font-weight: normal; + padding: 0 6px; + color: $secondary; + background-color: scale-color($tertiary, $lightness: 50%); + border-radius: 3px; + } } .current-badge {