Sha256: 9311aab378f82b861522aee00b6da3bae81c5fb81e41bd85d58a5552bac9bc64
Contents?: true
Size: 984 Bytes
Versions: 31
Compression:
Stored size: 984 Bytes
Contents
- if policy(document.class).preview? button( id = "preview-button" class = "btn btn-default" type = "button" data-url = url_for(action: :preview, format: :pdf) ) = icon(:eye) = " " = ta(:preview) coffee: $button = $("#preview-button").detach() $button.click -> data = $(this).parents("form").serializeArray() $form = $("<form>") # jQuery's form clone() does not work with select2 data.map (e) -> return if e.name == "_method" # always post return if e.name.indexOf("[lines_attributes]") >= 0 && e.name.indexOf("[id]") >= 0 $input = $("<input/>").attr(type: "hidden", name: e.name, value: e.value) $form.append($input) $form.attr(action: $button.data("url"), method: "post", target: "_blank") $form.hide() $(document.body).append($form) $form.submit() $form.remove() $submit = $("form [type=submit]") $button.insertBefore($submit)
Version data entries
31 entries across 31 versions & 1 rubygems