Moved everything into new files. Made editor.js.erb really small.
This commit is contained in:
16
app/assets/javascripts/editor/ajax.js.erb
Normal file
16
app/assets/javascripts/editor/ajax.js.erb
Normal file
@@ -0,0 +1,16 @@
|
||||
CodeOceanEditorAJAX = {
|
||||
ajax: function(options) {
|
||||
return $.ajax(_.extend({
|
||||
dataType: 'json',
|
||||
method: 'POST',
|
||||
}, options));
|
||||
},
|
||||
|
||||
ajaxError: function(response) {
|
||||
var message = ((response || {}).responseJSON || {}).message || '';
|
||||
|
||||
$.flash.danger({
|
||||
text: message.length > 0 ? message : $('#flash').data('message-failure')
|
||||
});
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user