diff options
author | claucece <soficeli0@gmail.com> | 2015-09-21 23:27:05 -0500 |
---|---|---|
committer | claucece <soficeli0@gmail.com> | 2015-10-05 22:39:30 -0500 |
commit | 2e1d21f53f0f96fba544b592fde84af2f4879a24 (patch) | |
tree | fc7d512c67002774ac8135dee16cc7f7ccd1919e /engines/billing/app/views/subscriptions | |
parent | f55fd33542c68fc8fc4519d622a41ef9517ebee3 (diff) |
subscriptions, haml and translations
Diffstat (limited to 'engines/billing/app/views/subscriptions')
3 files changed, 48 insertions, 15 deletions
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 @@ +<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/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 @@ +<script src="https://js.braintreegateway.com/v2/braintree.js"></script> +<h2 class="mbs">Subscriptions</h2> +<br> +<%= form_tag subscriptions_path, id: "checkout-form" do %> + <% if current_user and !current_user.has_payment_info? %> + <%= render 'customer_form' unless @anonymous_user%> + <% end %> +<br> +<p>Choose subcription:</p> +<ul> + <% @subscriptions.each do |subscription| %> + <li> + <%= subscription.name %> + - + <%= subscription.price %> + <%= simple_form_for :subscription, :url => :subscriptions, :id => "checkout-form-#{subscription.id}" do |f| %> + <input type="hidden" name="plan_id" id="" value="<%= subscription.id%>" /> + <div id="payment-form-<%= subscription.id%>"></div> + <div class="form-actions"> + <%= f.submit t(:subscribe), :class => 'btn btn-primary' %> + </div> + <script type="text/javascript" charset="utf-8"> + var clientToken = "<%= @client_token %>"; + braintree.setup(clientToken, "dropin", { + container: "payment-form-<%= subscription.id%>", + coinbase: { container: "coinbase-container-id" } + }); + </script> + <% end %> + </li> + <% end %> +</ul> +<div id="payment-form"></div> +<div id='coinbase-container-id'></div> +<% 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 |