o: ActiveSupport::Cache::Entry :@created_atf1330888478.534976= : @value"Ï["Ç $(function() { $(".simple_attachments_singleton_div").bind("new_field", function(event, field) { field.appendTo($(this).children(".simple_attachments_add_file_div")); field.bind("loaded", function(event, data) { $("").attr("src", data.filepath).appendTo(this); }); }); $(".simple_attachments_multiple_div").bind("new_field", function(event, field) { field.appendTo(this); field.bind("loaded", function(event, data) { data.destroy_link.appendTo(this); data.attachment_link.html(data.filename).appendTo(this); }); }); }); var simple_attachments = { getCSRF: function() { var name = $("meta[name=csrf-param]"); var value = $("meta[name=csrf-token]"); name = (name.length ? name.attr("content") : "authenticity_token"); value = (value.length ? value.attr("content") : ""); return {name: name, value: value} }, setFieldsData: function(event, data) { var field = $(event.currentTarget); var div = event.data.div; var options = div.options; $("").attr("type", "hidden").attr("name", div.input_name).attr("value", data.id).appendTo(field); data.destroy_link = null; if (options.can_destroy) { data.destroy_link = $("").attr("class", "simple_attachments_destroy_link").attr("href", data.filepath); data.destroy_link.bind("click", {field: field, destroy_remote: options.destroy_remote}, function(event) { if (event.data.destroy_remote) { var csrf = simple_attachments.getCSRF(); var post = {_method: "delete"}; post[csrf.name] = csrf.value; $.post(this.href, post); } event.data.field.remove(); return false; }); } data.attachment_link = $("").attr("class", "simple_attachments_attachment_link").attr("href", data.filepath); data.div = div; field.trigger("loaded", [data]); }, createInput: function(event) { var div = $(event.currentTarget); var input = $("").attr("type", "file").attr("class", "simple_attachments_input").attr("name", "file"); input.appendTo(div.find(".simple_attachments_add_file_div")); var form = $("
").attr("method", "post").attr("action", div.attr("data-attachments-path")).attr("enctype", "multipart/form-data").attr("accept-charset", "UTF-8"); var csrf = simple_attachments.getCSRF(); $("").attr("type", "hidden").attr("name", csrf.name).attr("value", csrf.value).appendTo(form); $("").attr("type", "hidden").attr("name", "container_id").attr("value", div.attr("data-container-id")).appendTo(form); $("").attr("type", "hidden").attr("name", "container_model").attr("value", div.attr("data-container-model")).appendTo(form); $("").attr("type", "hidden").attr("name", "method").attr("value", div.attr("data-method")).appendTo(form); input.bind("change", {div: div, form: form}, simple_attachments.createIframe); }, createIframe: function(event) { var input = $(event.currentTarget); var div = event.data.div; var form = event.data.form; var iframe = $("