Sha256: df69cb200058ffeb62ae0655d3120cbe9335d7c2216e92f911e4324a57c82626

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

/* ajax_windows.js.  Support for modal popup windows in Umlaut items. */
jQuery(document).ready(function($) {
  var ajax_form_catch, shared_modal_d;
  shared_modal_d = $("<div></div>").dialog({
    autoOpen: false,
    modal: true,
    width: "400px"
  });
  $(document).on("click", "a.ajax_window", function(event) {
    $(shared_modal_d).load(this.href, function() {
      var heading;
      heading = shared_modal_d.find("h1, h2, h3, h4, h5, h6").eq(0).remove();
      $(shared_modal_d).dialog("option", "title", heading.text());
      return $(shared_modal_d).dialog("open");
    });
    return false;
  });
  ajax_form_catch = function(event) {
    $(shared_modal_d).load($(event.target).closest("form").attr("action"), $(event.target).closest("form").serialize(), function() {
      var heading;
      heading = shared_modal_d.find("h1, h2, h3, h4, h5, h6").eq(0).remove();
      $(shared_modal_d).dialog("option", "title", heading.text());
      return $(shared_modal_d).dialog("open");
    });
    return false;
  };
  $(document).on("click", "form.modal_dialog_form input[type=submit]", ajax_form_catch);
  return $(document).on("submit", "form.modal_dialog_form", ajax_form_catch);
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
umlaut-3.0.5 app/assets/javascripts/umlaut/ajax_windows.js