master
Nick Sergeant 2012-03-08 08:59:15 -05:00
parent 58876ccd85
commit 7aa3f07050
1 changed files with 33 additions and 40 deletions

View File

@ -37,7 +37,6 @@
}, },
copy: function() { copy: function() {
if (!window.ui_halted) {
window.ui_halted = true; window.ui_halted = true;
this.$copyModalBody.append('<textarea class="raw"></textarea>'); this.$copyModalBody.append('<textarea class="raw"></textarea>');
@ -45,7 +44,6 @@
this.$copyModal.modal('show'); this.$copyModal.modal('show');
$textarea.select(); $textarea.select();
}
}, },
copyClose: function() { copyClose: function() {
$('textarea', this.$copyModal).remove(); $('textarea', this.$copyModal).remove();
@ -62,11 +60,14 @@
window.location = this.model.get('get_absolute_url'); window.location = this.model.get('get_absolute_url');
}, },
edit: function() { edit: function() {
if (!window.ui_halted) { window.editing = true;
window.ui_halted = true;
this.select(); this.select();
var editPane = this.editTemplate({
snipt: this.model.toJSON() var editPane = this.editTemplate({snipt: this.model.toJSON()});
}); var JavaScriptMode = require('ace/mode/javascript').Mode;
window.site.$main.hide(); window.site.$main.hide();
window.site.$body.addClass('detail editing'); window.site.$body.addClass('detail editing');
window.site.$main_edit.html(editPane).show(); window.site.$main_edit.html(editPane).show();
@ -75,9 +76,7 @@
window.editor = ace.edit('editor'); window.editor = ace.edit('editor');
window.editor.setTheme('ace/theme/tomorrow'); window.editor.setTheme('ace/theme/tomorrow');
window.editor.renderer.setShowGutter(false); window.editor.renderer.setShowGutter(false);
var JavaScriptMode = require('ace/mode/javascript').Mode;
window.editor.getSession().setMode(new JavaScriptMode()); window.editor.getSession().setMode(new JavaScriptMode());
window.editor.$textarea = $('textarea', window.editor.container); window.editor.$textarea = $('textarea', window.editor.container);
window.editor.focus(); window.editor.focus();
window.editor.$textarea.bind('keydown', 'esc', function(e) { window.editor.$textarea.bind('keydown', 'esc', function(e) {
@ -87,13 +86,9 @@
window.scrollTo(0, 0); window.scrollTo(0, 0);
window.editing = true;
window.ui_halted = true;
}
return false; return false;
}, },
embed: function() { embed: function() {
if (!window.ui_halted) {
window.ui_halted = true; window.ui_halted = true;
this.$embedModalBody.append('<textarea class="raw"></textarea>'); this.$embedModalBody.append('<textarea class="raw"></textarea>');
@ -101,7 +96,6 @@
this.$embedModal.modal('show'); this.$embedModal.modal('show');
$textarea.select(); $textarea.select();
}
}, },
embedClose: function() { embedClose: function() {
$('textarea', this.$embedModal).remove(); $('textarea', this.$embedModal).remove();
@ -123,7 +117,6 @@
this.$copyModal = $('div.copy-modal', this.$el); this.$copyModal = $('div.copy-modal', this.$el);
this.$copyModalBody = $('div.modal-body', this.$copyModal); this.$copyModalBody = $('div.modal-body', this.$copyModal);
this.$embedModal = $('div.embed-modal', this.$el); this.$embedModal = $('div.embed-modal', this.$el);
this.$embedModalBody = $('div.modal-body', this.$embedModal); this.$embedModalBody = $('div.modal-body', this.$embedModal);