diff options
Diffstat (limited to 'engines/billing/app/views/payments')
6 files changed, 58 insertions, 60 deletions
diff --git a/engines/billing/app/views/payments/_customer_form.html.erb b/engines/billing/app/views/payments/_customer_form.html.erb deleted file mode 100644 index 2e8a3b1..0000000 --- a/engines/billing/app/views/payments/_customer_form.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<p>Please enter your personal info:</p> -<div class="mb1"> - <%= text_field_tag :first_name, "",placeholder: "First Name", class: "radius" %> -</div> -<div class="mb1"> - <%= text_field_tag :last_name, "",placeholder: "Last Name", class: "radius" %> -</div> -<div class="mb1"> - <%= text_field_tag :company, "",placeholder: "Company", class: "radius" %> -</div> -<div class="mb1"> - <%= text_field_tag :phone, "",placeholder: "Phone", class: "radius" %> -</div> diff --git a/engines/billing/app/views/payments/_customer_form.html.haml b/engines/billing/app/views/payments/_customer_form.html.haml new file mode 100644 index 0000000..82828cd --- /dev/null +++ b/engines/billing/app/views/payments/_customer_form.html.haml @@ -0,0 +1,10 @@ +%p + = t(:personal_info) +%div + = text_field_tag :first_name, "",placeholder: "First Name", class: "radius" +%div + = text_field_tag :last_name, "",placeholder: "Last Name", class: "radius" +%div + = text_field_tag :company, "",placeholder: "Company", class: "radius" +%div + = text_field_tag :phone, "",placeholder: "Phone", class: "radius" diff --git a/engines/billing/app/views/payments/_form.html.erb b/engines/billing/app/views/payments/_form.html.erb deleted file mode 100644 index 9713981..0000000 --- a/engines/billing/app/views/payments/_form.html.erb +++ /dev/null @@ -1,16 +0,0 @@ --# slim template -= form_tag organization_payment_path(organization) do - - #dropin - - = submit_tag 'Confirm', class: 'btn push--ends' - -- content_for :javascript do - = javascript_include_tag "https://js.braintreegateway.com/v2/braintree.js" - javascript: - var client_token = "#{@organization.payment['client_token']}"; - braintree.setup( - client_token, - 'dropin', { - container: 'dropin' - }); diff --git a/engines/billing/app/views/payments/default.html.erb b/engines/billing/app/views/payments/default.html.erb new file mode 100644 index 0000000..bbecf46 --- /dev/null +++ b/engines/billing/app/views/payments/default.html.erb @@ -0,0 +1,27 @@ +<h2 class="mbs">New Donation</h2> +<br> +<%= form_tag confirm_payment_path, id: "checkout-form" do %> + <% if current_user and !current_user.has_payment_info? %> + <%= render 'customer_form' unless @anonymous_user%> + <% end %> +<br> +<p>Please enter your donation details (this is a donation and will not be applied towards your account):</p> +<div id="payment-form"></div> +<div id='coinbase-container-id'></div> +<input type="text" name="amount" placeholder="Enter amount"> +<input type="submit" class="btn btn-primary" value="Donate"> +<% end %> + +<script src="https://js.braintreegateway.com/v2/braintree.js"></script> +<script> + // We generated a client token for you so you can test out this code + // immediately. In a production-ready integration, you will need to + // generate a client token on your server (see section below). +var clientToken = "<%= @client_token %>"; +braintree.setup(clientToken, "dropin", { + container: "payment-form", + form: "checkout-form", + coinbase: { container: "coinbase-container-id" } +} + ); +</script> diff --git a/engines/billing/app/views/payments/new.html.erb b/engines/billing/app/views/payments/new.html.erb deleted file mode 100644 index 03fc5b9..0000000 --- a/engines/billing/app/views/payments/new.html.erb +++ /dev/null @@ -1,31 +0,0 @@ -<h2 class="mbs">New Donation</h2> -<br> -<%= form_tag confirm_payment_path, id: "checkout-form" do %> - <%# add migration to user first. Not sure about the anonymous part. %> - <%# render 'customer_form' unless current_user.has_payment_info? && current_user.where.not.is_anonymous? %> - <% if current_user and !current_user.has_payment_info? %> - <%= render 'customer_form' unless @anonymous_user%> - <% end %> - <br> - <p>Please enter your donation details (this is a donation and will not be applied towards your account):</p> - <div id="payment-form"></div> - <div id='coinbase-container-id'></div> - <input type="text" name="amount" placeholder="Enter amount"> - <input type="submit" class="btn btn-primary" value="Donate"> -<% end %> - -<script src="https://js.braintreegateway.com/v2/braintree.js"></script> -<script> -// We generated a client token for you so you can test out this code -// immediately. In a production-ready integration, you will need to -// generate a client token on your server (see section below). -var clientToken = "<%= @client_token %>"; - -braintree.setup(clientToken, "dropin", { - container: "payment-form", - form: "checkout-form", - coinbase: { container: "coinbase-container-id" } -} - ); -</script> - diff --git a/engines/billing/app/views/payments/new.html.haml b/engines/billing/app/views/payments/new.html.haml new file mode 100644 index 0000000..8d5bd5a --- /dev/null +++ b/engines/billing/app/views/payments/new.html.haml @@ -0,0 +1,21 @@ +%h2.mbs + = t(:new_donation) +%br/ += form_tag confirm_payment_path, id: "checkout-form" do + - if current_user and !current_user.has_payment_info? + = render 'customer_form' unless current_user.is_anonymous? + %br/ + %p + = t(:donation_info) + %div{:id => "payment-form" } + %div{:id => "coinbase-container-id" } + %input{:name => "amount", :placeholder => "Enter amount", :type => "text"} + %input.btn.btn-primary{:type => "submit", :value => "Donate"} +%script{:src => "https://js.braintreegateway.com/v2/braintree.js"} +:javascript + var clientToken = "#{@client_token}"; + braintree.setup(clientToken, "dropin", { + container: "payment-form", + form: "checkout-form", + coinbase: { container: "coinbase-container-id" } + }); |