Sha256: 393e6de90a59e0ef09b8df98a94738e4ad6d094587e61bc8d91957f22d8bd1ff

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

# ajax_windows.js.  Support for modal popup windows in Umlaut items.
$ ->
  shared_modal_d = $("<div></div>").dialog({autoOpen: false, modal: true, width: "400px"})
  $("a.ajax_window").live "click", (event)->                
      $(shared_modal_d).load this.href, ->
          heading = shared_modal_d.find("h1, h2, h3, h4, h5, h6").eq(0).remove()
          $(shared_modal_d).dialog "option", "title", heading.text()
          $(shared_modal_d).dialog "open" 
      false

  ajax_form_catch = (event) ->
    $(shared_modal_d).load $(event.target).closest("form").attr("action"), $(event.target).closest("form").serialize(), ->
        heading = shared_modal_d.find("h1, h2, h3, h4, h5, h6").eq(0).remove()
        $(shared_modal_d).dialog "option", "title", heading.text()
        $(shared_modal_d).dialog "open"
    return false;

  # # Trapping two events, click on the submit button or submit on the form
  # # is strangely needed in IE7 to trap both return-in-field submits
  # # and click-on-button submits. In FF just the second "submit" version
  # # is sufficient. 
  $("form.modal_dialog_form input[type=submit]").live "click", ajax_form_catch
  $("form.modal_dialog_form").live "submit", ajax_form_catch 

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
umlaut-3.0.4 app/assets/javascripts/umlaut/ajax_windows.js.coffee