Sha256: 4ea4a68c74ef047fe810eed17c44bc19c843adb2145a22d43543902171ebab15

Contents?: true

Size: 1.18 KB

Versions: 38

Compression:

Stored size: 1.18 KB

Contents


(function() {
  
  function showFormInPopover(the_form, path) {
    the_form.attr("action",path.replace(/\/(edit|new)$/,''));

    $("#my-pop-over").remove();
    $('.modal').clone().attr("id",'my-pop-over').appendTo("body");
    $("#my-pop-over .modal-body").append(the_form);

    $("#my-pop-over .modal-header h3").text(the_form.find(" > fieldset > legend").text());
    the_form.find(" > fieldset > legend").remove();

    the_form.find(".form-actions").hide();
    the_form.find(".form-actions").find('button, input, a').each(function() {
      var _this = this;
      var new_button = $(this).clone().attr("onclick",'').removeAttr('data-confirm').removeAttr('data-method');
      new_button.appendTo("#my-pop-over .modal-footer");
      new_button.click(function(event) {
        event.preventDefault();
        if($(this).text() === "Cancel") {
          $("#my-pop-over").modal("hide");
        } else {
          $(_this).click();
        }
      });
    });

    $("#my-pop-over").modal('show').one('shown',function() {
      $(this).find('input').not("input[type=button],input[type=hidden],input[type=submit]").first().focus();
    });
  }
  
  window.showFormInPopover = showFormInPopover;
  
}());

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
burp_cms-1.7.1 app/assets/javascripts/burp/form_popover.js
burp_cms-1.7.0 app/assets/javascripts/burp/form_popover.js
burp_cms-1.6.0 app/assets/javascripts/burp/form_popover.js
burp_cms-1.5.13 app/assets/javascripts/burp/form_popover.js
burp_cms-1.5.12 app/assets/javascripts/burp/form_popover.js
burp_cms-1.5.11 app/assets/javascripts/burp/form_popover.js
burp_cms-1.5.10 app/assets/javascripts/burp/form_popover.js
burp_cms-1.5.9 app/assets/javascripts/burp/form_popover.js
burp_cms-1.5.8 app/assets/javascripts/burp/form_popover.js
burp_cms-1.5.7 app/assets/javascripts/burp/form_popover.js
burp_cms-1.5.6 app/assets/javascripts/burp/form_popover.js
burp_cms-1.5.5 app/assets/javascripts/burp/form_popover.js
burp_cms-1.5.4 app/assets/javascripts/burp/form_popover.js
burp_cms-1.5.3 app/assets/javascripts/burp/form_popover.js
burp_cms-1.5.2 app/assets/javascripts/burp/form_popover.js
burp_cms-1.5.1 app/assets/javascripts/burp/form_popover.js
burp_cms-1.5.0 app/assets/javascripts/burp/form_popover.js
burp_cms-1.4.1 app/assets/javascripts/burp/form_popover.js
burp_cms-1.4.0 app/assets/javascripts/burp/form_popover.js
burp_cms-1.3.33 app/assets/javascripts/burp/form_popover.js