2013-02-20 13:15:50 -05:00
|
|
|
/*global Mousetrap:true */
|
2013-02-22 15:41:12 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
A view to handle site customizations
|
|
|
|
|
2013-03-01 12:45:25 -05:00
|
|
|
@class AdminCustomizeView
|
|
|
|
@extends Discourse.View
|
2013-02-22 15:41:12 -05:00
|
|
|
@namespace Discourse
|
|
|
|
@module Discourse
|
2013-03-01 12:45:25 -05:00
|
|
|
**/
|
2013-02-22 15:41:12 -05:00
|
|
|
Discourse.AdminCustomizeView = Discourse.View.extend({
|
|
|
|
templateName: 'admin/templates/customize',
|
|
|
|
classNames: ['customize'],
|
2014-01-22 10:52:09 -05:00
|
|
|
selected: 'stylesheet',
|
2014-11-10 15:51:55 -05:00
|
|
|
|
2014-04-16 09:49:06 -04:00
|
|
|
headerActive: Em.computed.equal('selected', 'header'),
|
2014-11-10 15:51:55 -05:00
|
|
|
footerActive: Em.computed.equal('selected', 'footer'),
|
2014-04-16 09:49:06 -04:00
|
|
|
stylesheetActive: Em.computed.equal('selected', 'stylesheet'),
|
2014-01-22 10:52:09 -05:00
|
|
|
mobileHeaderActive: Em.computed.equal('selected', 'mobileHeader'),
|
2014-11-10 15:51:55 -05:00
|
|
|
mobileFooterActive: Em.computed.equal('selected', 'mobileFooter'),
|
2014-01-22 10:52:09 -05:00
|
|
|
mobileStylesheetActive: Em.computed.equal('selected', 'mobileStylesheet'),
|
|
|
|
|
|
|
|
actions: {
|
2014-04-16 09:49:06 -04:00
|
|
|
selectHeader: function() { this.set('selected', 'header'); },
|
2014-11-10 15:51:55 -05:00
|
|
|
selectFooter: function() { this.set('selected', 'footer'); },
|
2014-04-16 09:49:06 -04:00
|
|
|
selectStylesheet: function() { this.set('selected', 'stylesheet'); },
|
2014-01-22 10:52:09 -05:00
|
|
|
selectMobileHeader: function() { this.set('selected', 'mobileHeader'); },
|
2014-11-10 15:51:55 -05:00
|
|
|
selectMobileFooter: function() { this.set('selected', 'mobileFooter'); },
|
2015-01-01 19:25:15 -05:00
|
|
|
selectMobileStylesheet: function() { this.set('selected', 'mobileStylesheet'); },
|
|
|
|
toggleMaximize: function() {
|
|
|
|
this.set("maximized", !this.get("maximized"));
|
|
|
|
|
|
|
|
Em.run.scheduleOnce('afterRender', this, function(){
|
|
|
|
$('.ace-wrapper').each(function(){
|
|
|
|
$(this).data("editor").resize();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
2013-09-16 12:21:49 -04:00
|
|
|
},
|
|
|
|
|
2013-02-22 15:41:12 -05:00
|
|
|
didInsertElement: function() {
|
2013-06-07 12:13:46 -04:00
|
|
|
var controller = this.get('controller');
|
2014-01-22 10:52:09 -05:00
|
|
|
Mousetrap.bindGlobal('mod+s', function() {
|
|
|
|
controller.send("save");
|
2013-02-22 15:41:12 -05:00
|
|
|
return false;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
willDestroyElement: function() {
|
2014-01-22 10:52:09 -05:00
|
|
|
Mousetrap.unbindGlobal('mod+s');
|
2013-02-22 15:41:12 -05:00
|
|
|
}
|
2013-03-01 12:45:25 -05:00
|
|
|
|
2013-02-22 15:41:12 -05:00
|
|
|
});
|