mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 19:35:09 +08:00
60 lines
1.4 KiB
JavaScript
60 lines
1.4 KiB
JavaScript
/**
|
|
This controller supports interface for creating custom CSS skins in Discourse.
|
|
|
|
@class AdminCustomizeController
|
|
@extends Ember.Controller
|
|
@namespace Discourse
|
|
@module Discourse
|
|
**/
|
|
Discourse.AdminCustomizeController = Ember.Controller.extend({
|
|
|
|
/**
|
|
Create a new customization style
|
|
|
|
@method newCustomization
|
|
**/
|
|
newCustomization: function() {
|
|
var item = Discourse.SiteCustomization.create({name: Em.String.i18n("admin.customize.new_style")});
|
|
this.get('content').pushObject(item);
|
|
this.set('content.selectedItem', item);
|
|
},
|
|
|
|
/**
|
|
Select a given style
|
|
|
|
@method selectStyle
|
|
@param {Discourse.SiteCustomization} style The style we are selecting
|
|
**/
|
|
selectStyle: function(style) {
|
|
this.set('content.selectedItem', style);
|
|
},
|
|
|
|
/**
|
|
Save the current customization
|
|
|
|
@method save
|
|
**/
|
|
save: function() {
|
|
this.get('content.selectedItem').save();
|
|
},
|
|
|
|
/**
|
|
Destroy the current customization
|
|
|
|
@method destroy
|
|
**/
|
|
destroy: function() {
|
|
var _this = this;
|
|
return bootbox.confirm(Em.String.i18n("admin.customize.delete_confirm"), Em.String.i18n("no_value"), Em.String.i18n("yes_value"), function(result) {
|
|
var selected;
|
|
if (result) {
|
|
selected = _this.get('content.selectedItem');
|
|
selected.destroy();
|
|
_this.set('content.selectedItem', null);
|
|
return _this.get('content').removeObject(selected);
|
|
}
|
|
});
|
|
}
|
|
|
|
});
|