mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Badges admin UI improvements.
* Query param to allow linking. * Better handling of deleting unsaved badges. * New badge list item style improvement.
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user