o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1337815045.123491: @value"¼{I" class:EFI"ProcessedAsset;FI"logical_path;F"cms/attachment_manager.jsI" pathname;F"‘/Users/josiahivey/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/browsercms-3.5.0.alpha/app/assets/javascripts/cms/attachment_manager.js.erbI"content_type;FI"application/javascript;FI" mtime;FI"2012-05-15T13:58:23-05:00;FI" length;FièI" digest;F"%0d6377997f9b8ecfa320884c360d8afbI" source;FI"è// Allows users to upload files via AJAX as attachments for a given block. // $(function () { // Return the authenticity token for any JS function that needs to do AJAX. // Since AJAX posts will fail if you don't attach this as defined here: http://michaelhendrickx.com/201012_jquery-ajax-with-rails-authenticity-token.html $.cms.auth_token = function () { return $('meta[name=csrf-token]').attr('content'); }; $.cms.AttachmentManager = { upload:function (file) { var assetName = $('#asset_types').val() , attachableClass = $('#asset_attachable_class').val() , attachableIDField = $('#asset_attachable_id') , attachableID = attachableIDField.val() , file = $('#asset_add_file') , clone = file.clone() , form = $('
') , fields = ''; fields += ''; fields += ''; fields += ''; fields += ''; fields += ''; $('body').append(form); form.append(fields); form.append(file); attachableIDField.after(clone); var inp = $(''); clone.after($('') .css({position:'static', margin:'5px 0 0 5px', 'verticalAlign':'middle'}) .attr({'id':'file-asset-uploader', 'src':'/assets/cms/file-uploading.gif'})); clone.replaceWith(inp); form.submit(); $('div.buttons').hide(); }, // @param [Integer] id The id of the attachment to delete. destroy:function (id) { if (confirm("Are you sure want to delete this attachment?")) { $.post('/cms/attachments/' + id, {_method:'delete', authenticity_token:$.cms.auth_token()}, function (attachment_id) { console.log(attachment_id); $("#attachment_" + attachment_id).hide(); if ($("#assets_table > table tr:visible").length <= 2) { $("#assets_table > table").hide(); } }, 'script'); } return false; } } $('#asset_types').selectbox({width:'445px'}); $('#asset_types').change(function () { if ($(this).val().indexOf('Select') != 0) { $('#asset_add').show(); } else { $('#asset_add').hide(); } }); // After an attachment is uploaded, copy the values into the main attachment table. $('#asset_add_uploader').load(function () { var response = $(this).contents(); if (response.find('tr').html()) { var asset = $(response).find('tr').clone(); var id = $(response).find("#asset-id").html(); var asset_ids = $('#attachment_manager_ids_list'); $(asset_ids).val($(asset_ids).val() + id + ","); $('#file-asset-uploader').remove(); $('#assets_table > table').append(asset).show(); $('div.buttons').show(); } }); }); ;FI"dependency_digest;F"%d3daab1a1bde2141cfa4ed1dcbe952fdI"required_paths;F["‘/Users/josiahivey/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/browsercms-3.5.0.alpha/app/assets/javascripts/cms/attachment_manager.js.erbI"dependency_paths;F[{I" path;F"‘/Users/josiahivey/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/browsercms-3.5.0.alpha/app/assets/javascripts/cms/attachment_manager.js.erbI" mtime;FI"2012-05-15T13:58:23-05:00;FI" digest;F"%99d60bb4a74728cc2b461f05453c0aa7I" _version;F"%9f3b95dd7ea3030dc35985c0a8020862