summaryrefslogtreecommitdiff
path: root/engines/billing/app/views/subscriptions/new12.html.haml
blob: 8b302f215360880d97830c2d476c490877854482 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
%script{:src => "https://js.braintreegateway.com/v2/braintree.js"}
%h2.mbs Subscriptions
%br/
= form_tag subscriptions_path, id: "checkout-form" do
  - if current_user and !current_user.has_payment_info?
    = render 'customer_form'
  %br/
  %p Choose subcription:
  %ul
  - @subscriptions.each do |subscription|
  %li
  = subscription.name
  = subscription.price
  = simple_form_for :subscription, :url => :subscriptions, :id => "checkout-form-#{subscription.id}" do |f|
  %input{:id => "", :name => "plan_id", :type => "hidden", :value => subscription.id}
  %div{:id => "payment-form-#{subscription.id}"}
  .form-actions
    = f.submit t(:subscribe), :class => 'btn btn-primary'
  %script{:charset => "utf-8", :type => "text/javascript"}
  :cdata
    var clientToken = "#{@client_token}";
    braintree.setup(clientToken, "dropin", {
      container: "payment-form-#{subscription.id}",
      coinbase: { container: "coinbase-container-id" }
    });
#payment-form
#coinbase-container-id