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