2013-02-21 02:15:50 +08:00
|
|
|
/*global Mousetrap:true */
|
2013-02-23 04:41:12 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
A view to handle site customizations
|
|
|
|
|
2013-03-02 01:45:25 +08:00
|
|
|
@class AdminCustomizeView
|
|
|
|
@extends Discourse.View
|
2013-02-23 04:41:12 +08:00
|
|
|
@namespace Discourse
|
|
|
|
@module Discourse
|
2013-03-02 01:45:25 +08:00
|
|
|
**/
|
2013-02-23 04:41:12 +08:00
|
|
|
Discourse.AdminCustomizeView = Discourse.View.extend({
|
|
|
|
templateName: 'admin/templates/customize',
|
|
|
|
classNames: ['customize'],
|
|
|
|
|
|
|
|
init: function() {
|
|
|
|
this._super();
|
|
|
|
this.set('selected', 'stylesheet');
|
|
|
|
},
|
|
|
|
|
|
|
|
headerActive: (function() {
|
|
|
|
return this.get('selected') === 'header';
|
|
|
|
}).property('selected'),
|
|
|
|
|
|
|
|
stylesheetActive: (function() {
|
|
|
|
return this.get('selected') === 'stylesheet';
|
|
|
|
}).property('selected'),
|
|
|
|
|
|
|
|
selectHeader: function() {
|
|
|
|
this.set('selected', 'header');
|
|
|
|
},
|
|
|
|
|
|
|
|
selectStylesheet: function() {
|
|
|
|
this.set('selected', 'stylesheet');
|
|
|
|
},
|
|
|
|
|
|
|
|
didInsertElement: function() {
|
2013-06-08 00:13:46 +08:00
|
|
|
var controller = this.get('controller');
|
2013-02-23 04:41:12 +08:00
|
|
|
return Mousetrap.bindGlobal(['meta+s', 'ctrl+s'], function() {
|
2013-06-08 00:13:46 +08:00
|
|
|
controller.save();
|
2013-02-23 04:41:12 +08:00
|
|
|
return false;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
willDestroyElement: function() {
|
|
|
|
return Mousetrap.unbindGlobal('meta+s', 'ctrl+s');
|
|
|
|
}
|
2013-03-02 01:45:25 +08:00
|
|
|
|
2013-02-23 04:41:12 +08:00
|
|
|
});
|