Repository URL to install this package:
|
Version:
0.2.1 ▾
|
var code;
(function($) {
"use strict";
$(function() {
var $body = $('body');
$body.on('reveal click', '[data-reveal]', function(e) {
e.preventDefault();
var reveal_id = $(this).data('reveal'),
$modal = $("#" + reveal_id),
path = $(this).data('html-path');
$.get(path, {},
function(data, textStatus, xhr) {
$modal.html(data).reveal();
});
});
$body.on('submit', '#new_image', function(e) {
e.preventDefault();
var data = $(this).serialize();
$.post(this.action, data,
function(data, textStatus, xhr) {
$('#image-picker').reveal({
open: function() {
$.get('/admin/images/picker', {},
function(data, textStatus, xhr) {
$('#image-picker').html(data);
});
}
});
});
});
$body.on('click', '#image-picker section a', function(e) {
e.preventDefault();
var $img,
align = $(this).data('align'),
$parent = $(this).parents('.asset');
Editor.instance.composer.commands.exec("insertImage", {
src: $parent.data('src'),
alt: '',
"class": align
});
$parent.trigger('reveal:close');
});
$body.on('click', '#toggle-code', function() {
$('.editor').hide();
$('.CodeMirror').toggle();
code.refresh();
});
});
})(jQuery);