From 2e1d21f53f0f96fba544b592fde84af2f4879a24 Mon Sep 17 00:00:00 2001 From: claucece Date: Mon, 21 Sep 2015 23:27:05 -0500 Subject: subscriptions, haml and translations --- .../app/views/payments/_customer_form.html.erb | 13 -------- .../app/views/payments/_customer_form.html.haml | 10 +++++++ engines/billing/app/views/payments/_form.html.erb | 16 ---------- .../billing/app/views/payments/default.html.erb | 27 +++++++++++++++++ engines/billing/app/views/payments/new.html.erb | 31 ------------------- engines/billing/app/views/payments/new.html.haml | 21 +++++++++++++ .../views/subscriptions/_customer_form.html.erb | 13 ++++++++ .../billing/app/views/subscriptions/new.html.erb | 35 ++++++++++++++++++++++ .../billing/app/views/subscriptions/new.html.haml | 15 ---------- 9 files changed, 106 insertions(+), 75 deletions(-) delete mode 100644 engines/billing/app/views/payments/_customer_form.html.erb create mode 100644 engines/billing/app/views/payments/_customer_form.html.haml delete mode 100644 engines/billing/app/views/payments/_form.html.erb create mode 100644 engines/billing/app/views/payments/default.html.erb delete mode 100644 engines/billing/app/views/payments/new.html.erb create mode 100644 engines/billing/app/views/payments/new.html.haml create mode 100644 engines/billing/app/views/subscriptions/_customer_form.html.erb create mode 100644 engines/billing/app/views/subscriptions/new.html.erb delete mode 100644 engines/billing/app/views/subscriptions/new.html.haml (limited to 'engines/billing/app/views') 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 @@ -

Please enter your personal info:

-
- <%= text_field_tag :first_name, "",placeholder: "First Name", class: "radius" %> -
-
- <%= text_field_tag :last_name, "",placeholder: "Last Name", class: "radius" %> -
-
- <%= text_field_tag :company, "",placeholder: "Company", class: "radius" %> -
-
- <%= text_field_tag :phone, "",placeholder: "Phone", class: "radius" %> -
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 @@ +

New Donation

+
+<%= 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 %> +
+

Please enter your donation details (this is a donation and will not be applied towards your account):

+
+
+ + +<% end %> + + + 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 @@ -

New Donation

-
-<%= 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 %> -
-

Please enter your donation details (this is a donation and will not be applied towards your account):

-
-
- - -<% end %> - - - - 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" } + }); diff --git a/engines/billing/app/views/subscriptions/_customer_form.html.erb b/engines/billing/app/views/subscriptions/_customer_form.html.erb new file mode 100644 index 0000000..2e8a3b1 --- /dev/null +++ b/engines/billing/app/views/subscriptions/_customer_form.html.erb @@ -0,0 +1,13 @@ +

Please enter your personal info:

+
+ <%= text_field_tag :first_name, "",placeholder: "First Name", class: "radius" %> +
+
+ <%= text_field_tag :last_name, "",placeholder: "Last Name", class: "radius" %> +
+
+ <%= text_field_tag :company, "",placeholder: "Company", class: "radius" %> +
+
+ <%= text_field_tag :phone, "",placeholder: "Phone", class: "radius" %> +
diff --git a/engines/billing/app/views/subscriptions/new.html.erb b/engines/billing/app/views/subscriptions/new.html.erb new file mode 100644 index 0000000..f3e143a --- /dev/null +++ b/engines/billing/app/views/subscriptions/new.html.erb @@ -0,0 +1,35 @@ + +

Subscriptions

+
+<%= form_tag subscriptions_path, id: "checkout-form" do %> + <% if current_user and !current_user.has_payment_info? %> + <%= render 'customer_form' unless @anonymous_user%> + <% end %> +
+

Choose subcription:

+ +
+
+<% end %> diff --git a/engines/billing/app/views/subscriptions/new.html.haml b/engines/billing/app/views/subscriptions/new.html.haml deleted file mode 100644 index 4183458..0000000 --- a/engines/billing/app/views/subscriptions/new.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -- if @payment_method_token - %h1 - Subscribe to plan - = #currently just one plan - = @plans[0].name - = number_to_currency(@plans[0].price) - = simple_form_for :subscription, :url => :subscriptions do |f| - = hidden_field_tag :payment_method_token, @payment_method_token - = hidden_field_tag :plan_id, @plans[0].id - .form-actions - = f.submit t(:subscribe), :class => 'btn btn-primary' -- else - = t(:must_create_customer) - %p - = link_to t(:create_new_customer), new_customer_path -- cgit v1.2.3