summaryrefslogtreecommitdiff
path: root/engines/billing/app/views
diff options
context:
space:
mode:
authorclaucece <soficeli0@gmail.com>2015-09-21 23:27:05 -0500
committerclaucece <soficeli0@gmail.com>2015-10-05 22:39:30 -0500
commit2e1d21f53f0f96fba544b592fde84af2f4879a24 (patch)
treefc7d512c67002774ac8135dee16cc7f7ccd1919e /engines/billing/app/views
parentf55fd33542c68fc8fc4519d622a41ef9517ebee3 (diff)
subscriptions, haml and translations
Diffstat (limited to 'engines/billing/app/views')
-rw-r--r--engines/billing/app/views/payments/_customer_form.html.haml10
-rw-r--r--engines/billing/app/views/payments/_form.html.erb16
-rw-r--r--engines/billing/app/views/payments/default.html.erb27
-rw-r--r--engines/billing/app/views/payments/new.html.erb31
-rw-r--r--engines/billing/app/views/payments/new.html.haml21
-rw-r--r--engines/billing/app/views/subscriptions/_customer_form.html.erb (renamed from engines/billing/app/views/payments/_customer_form.html.erb)0
-rw-r--r--engines/billing/app/views/subscriptions/new.html.erb35
-rw-r--r--engines/billing/app/views/subscriptions/new.html.haml15
8 files changed, 93 insertions, 62 deletions
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" }
+ });
diff --git a/engines/billing/app/views/payments/_customer_form.html.erb b/engines/billing/app/views/subscriptions/_customer_form.html.erb
index 2e8a3b1..2e8a3b1 100644
--- a/engines/billing/app/views/payments/_customer_form.html.erb
+++ b/engines/billing/app/views/subscriptions/_customer_form.html.erb
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