o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1338334708.280988: @value" {I" class:EFI"ProcessedAsset;FI"logical_path;F" active_admin/editor/core.jsI" pathname;F"i/Users/ejholmes/Source/active_admin_editor/app/assets/javascripts/active_admin/editor/core.js.coffeeI"content_type;FI"application/javascript;FI" mtime;FI"2012-05-29T16:38:26-07:00;FI" length;Fi¿I" digest;F"%e9aa6e3c155108c224cdeac31b9bb808I" source;FI"¿(function() { (function($) { $.fn.active_admin_editor = function(options) { var active_admin_editor, clear_assets, editor, image_dialog, load_assets, textarea_id, toolbar_id, uploader; active_admin_editor = $(this); if (active_admin_editor.length > 0) { textarea_id = active_admin_editor.find('textarea').attr('id'); toolbar_id = active_admin_editor.find('.active_admin_editor_toolbar').attr('id'); editor = new wysihtml5.Editor(textarea_id, { toolbar: toolbar_id, stylesheets: "/assets/wysiwyg.css", parserRules: wysihtml5ParserRules }); window.editor = editor; image_dialog = active_admin_editor.find('[data-wysihtml5-dialog="insertImage"]'); clear_assets = function() { active_admin_editor.find('#asset_uploader').hide(); image_dialog.find('.assets_container').html('').hide(); return image_dialog.find('.asset_scale_selection').hide(); }; load_assets = function(done) { var container, save_button, setDialogInput; if (done == null) { done = null; } container = image_dialog.find('.assets_container'); save_button = image_dialog.find('a[data-wysihtml5-dialog-action="save"]'); setDialogInput = function(field, val) { var f; f = image_dialog.find("[data-wysihtml5-dialog-field='" + field + "']"); return f.val(val); }; active_admin_editor.find('#asset_uploader').show(); $.getJSON('/admin/image_assets.json', function(data) { var list, populateSrc, selectedScale; list = $(''); $.each(data, function(i, asset) { var tag; tag = $("
  • \n \n
  • "); tag.find('img').data('image-src', asset.storage); return list.append(tag); }); container.append(list).show(); container.append($('')); container.paginate({ items_per_page: 10, show_first: false, show_last: false }); image_dialog.find('.asset_scale_selection').show(); selectedScale = function() { return image_dialog.find('input[@name="asset_scale"]:checked').data('scale'); }; populateSrc = function(el) { var scale, src; scale = selectedScale(); container.find('.asset').removeClass('active'); if (scale === 'full') { src = $(el).data('image-src').url; } else { src = $(el).data('image-src')[scale].url; } if (!src.match(/^(http|https)/gi)) { src = el.src.match(/(http|https):\/\/[^/]*/gi) + src; } setDialogInput('src', src); return $(el).parent().addClass('active'); }; image_dialog.find('input[name="asset_scale"]').click(function(e) { return populateSrc(image_dialog.find('.asset.active img')[0]); }); return container.find('img').click(function(e) { return populateSrc(this); }).dblclick(function(e) { var fireEvent; fireEvent = function(element, event) { var evt; if (document.createEvent) { evt = document.createEvent("HTMLEvents"); evt.initEvent(event, true, true); return !element.dispatchEvent(evt); } else { evt = document.createEventObject(); return element.fireEvent('on' + event, evt); } }; return fireEvent(save_button[0], 'click'); }); }); if (done) { return done(); } }; uploader = new qq.FileUploader({ element: document.getElementById('asset_uploader'), action: '/admin/image_assets.json', onComplete: function() { clear_assets(); return load_assets(); } }); return editor.on('show:dialog', function(dialog) { var image_input; image_input = image_dialog.find('input[data-wysihtml5-dialog-field="src"]'); if (dialog.command === 'insertImage') { clear_assets(); if (image_input.val() === 'http://') { return load_assets(); } } }); } }; return $(function() { return $('.active_admin_editor').active_admin_editor(); }); })(jQuery); }).call(this); ;TI"dependency_digest;F"%44632e9c64761c7d15d32cb14c5e7fb5I"required_paths;F["i/Users/ejholmes/Source/active_admin_editor/app/assets/javascripts/active_admin/editor/core.js.coffeeI"dependency_paths;F[{I" path;F"i/Users/ejholmes/Source/active_admin_editor/app/assets/javascripts/active_admin/editor/core.js.coffeeI" mtime;FI"2012-05-29T16:38:26-07:00;FI" digest;F"%090df6b877e44fe0301b560d0ae8beadI" _version;F"%aa7d0db7619379e13b08335dee027df2