podemos-info/census

View on GitHub
app/views/orders/payment_form.arb

Summary

Maintainability
Test Coverage
# frozen_string_literal: true

text_node Arbre::HTML::Document.new.doctype
html do
  body do
    form id: :form, action: form_info[:action], method: :post do
      form_info[:fields].each do |key, value|
        input type: :hidden, name: key, value: value
      end
    end
    script raw <<~NO_BACK_SCRIPT
      if (window.location.hash == '#sent') {
        window.history.go(-1);
      } else {
        window.history.replaceState( {} , '', '#sent' );
        document.getElementById('form').submit();
      }
    NO_BACK_SCRIPT
  end
end