o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1381787979.0737011: @value" {I" class:EFI"ProcessedAsset;FI"logical_path;FI"umlaut/ajax_windows.js;TI" pathname;FI"O/Users/jrochkind/code/umlaut/app/assets/javascripts/umlaut/ajax_windows.js;TI"content_type;FI"application/javascript;FI" mtime;FI"2013-10-14T10:46:31-04:00;FI" length;Fi I" digest;F"%ba3a8816e6a142cd88c90ef672d844c4I" source;FI" /* ajax_windows.js. Support for modal popup windows in Umlaut items. */ jQuery(document).ready(function($) { var populate_modal = function(data, textStatus, jqXHR) { // Wrap the data object in jquery object var body = $(data); // Remove the first heading from the returned data var header = body.find("h1, h2, h3, h4, h5, h6").eq(0).remove(); // Remove the first submit button from the returned data var footer = body.find("form").find("input[type=submit]").eq(0).remove(); cleanup_modal(header, body, footer) } var cleanup_modal = function() { header = arguments[0] body = arguments[1] footer = arguments[2] // Replace the header text if given if (header) $("#modal").find(".modal-header").find(".content").text(header.text()); // Replace the body html if given if (body) $("#modal").find(".modal-body").find(".content").html(body.html()); // Replace the current submit button if given if (footer) $("#modal").find(".modal-footer").find(".content").html(footer); // Toggle the ajax-loader $("#modal").find(".modal-header").find(".ajax-loader").toggle(); $("#modal").find(".modal-body").find(".ajax-loader").toggle(); // Toggle the content $("#modal").find(".modal-header").find(".content").toggle(); $("#modal").find(".modal-body").find(".content").toggle(); $("#modal").find(".modal-footer").find(".content").toggle(); } var display_modal = function(event) { event.preventDefault(); cleanup_modal(); $("#modal").modal("show"); $.get(this.href, "", populate_modal, "html"); return false; } var ajax_form_catch = function(event) { event.preventDefault(); cleanup_modal(); var form = $("#modal").find("form"); $.post(form.attr("action"), form.serialize(), populate_modal, "html"); return false; }; $(document).on("click", "a.ajax_window", display_modal); $(document).on("click", "#modal .modal-footer input[type=submit]", ajax_form_catch); $(document).on("submit", "#modal form", ajax_form_catch); }); ;FI"dependency_digest;F"%276066e8ddfddbc2aac97ef4661b3825I"required_paths;F[I"O/Users/jrochkind/code/umlaut/app/assets/javascripts/umlaut/ajax_windows.js;TI"dependency_paths;F[{I" path;FI"O/Users/jrochkind/code/umlaut/app/assets/javascripts/umlaut/ajax_windows.js;TI" mtime;FI"2013-10-14T10:46:31-04:00;FI" digest;F"%421da39c4835ae1ad212076ac8e65817I" _version;F"%6776f581a4329e299531e1d52aa59832