2013-02-22 15:41:12 -05:00
|
|
|
/**
|
|
|
|
This controller supports interface for creating custom CSS skins in Discourse.
|
|
|
|
|
2013-03-14 18:03:13 -04:00
|
|
|
@class AdminCustomizeController
|
2013-02-22 15:41:12 -05:00
|
|
|
@extends Ember.Controller
|
|
|
|
@namespace Discourse
|
|
|
|
@module Discourse
|
2013-03-14 18:03:13 -04:00
|
|
|
**/
|
2013-05-20 15:27:58 -04:00
|
|
|
Discourse.AdminCustomizeController = Ember.ArrayController.extend({
|
2013-02-22 15:41:12 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Create a new customization style
|
|
|
|
|
|
|
|
@method newCustomization
|
|
|
|
**/
|
|
|
|
newCustomization: function() {
|
2013-07-08 19:32:16 -04:00
|
|
|
var item = Discourse.SiteCustomization.create({name: I18n.t("admin.customize.new_style")});
|
2013-05-20 15:27:58 -04:00
|
|
|
this.pushObject(item);
|
|
|
|
this.set('selectedItem', item);
|
2013-02-22 15:41:12 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
Select a given style
|
|
|
|
|
|
|
|
@method selectStyle
|
|
|
|
@param {Discourse.SiteCustomization} style The style we are selecting
|
|
|
|
**/
|
|
|
|
selectStyle: function(style) {
|
2013-05-20 15:27:58 -04:00
|
|
|
this.set('selectedItem', style);
|
2013-02-22 15:41:12 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
Save the current customization
|
|
|
|
|
|
|
|
@method save
|
|
|
|
**/
|
|
|
|
save: function() {
|
2013-05-20 15:27:58 -04:00
|
|
|
this.get('selectedItem').save();
|
2013-02-22 15:41:12 -05:00
|
|
|
},
|
2013-02-20 13:15:50 -05:00
|
|
|
|
2013-02-21 12:58:21 -05:00
|
|
|
/**
|
2013-02-22 15:41:12 -05:00
|
|
|
Destroy the current customization
|
|
|
|
|
|
|
|
@method destroy
|
|
|
|
**/
|
|
|
|
destroy: function() {
|
|
|
|
var _this = this;
|
2013-07-08 19:32:16 -04:00
|
|
|
return bootbox.confirm(I18n.t("admin.customize.delete_confirm"), I18n.t("no_value"), I18n.t("yes_value"), function(result) {
|
2013-02-22 15:41:12 -05:00
|
|
|
var selected;
|
|
|
|
if (result) {
|
2013-05-20 15:27:58 -04:00
|
|
|
selected = _this.get('selectedItem');
|
2013-03-21 15:10:34 -04:00
|
|
|
selected.destroy();
|
2013-05-20 15:27:58 -04:00
|
|
|
_this.set('selectedItem', null);
|
|
|
|
return _this.removeObject(selected);
|
2013-02-22 15:41:12 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|