summaryrefslogtreecommitdiff
path: root/engines/billing/app/views
diff options
context:
space:
mode:
authorclaucece <soficeli0@gmail.com>2015-09-25 00:04:19 -0500
committerclaucece <soficeli0@gmail.com>2015-10-05 22:41:20 -0500
commitb26d10fe7d87b570bd888fa2a2543f3675278f8b (patch)
tree2b73a88026b78ef5f78a881ac7c0eac91d6632ac /engines/billing/app/views
parent577c1f3e92040ab79fcd67b818c7dc8531aaa211 (diff)
add subscriptions
Diffstat (limited to 'engines/billing/app/views')
-rw-r--r--engines/billing/app/views/payments/new.html.haml5
-rw-r--r--engines/billing/app/views/subscriptions/index.html.erb38
-rw-r--r--engines/billing/app/views/subscriptions/show.html.erb16
3 files changed, 28 insertions, 31 deletions
diff --git a/engines/billing/app/views/payments/new.html.haml b/engines/billing/app/views/payments/new.html.haml
index 8d5bd5a..67018b2 100644
--- a/engines/billing/app/views/payments/new.html.haml
+++ b/engines/billing/app/views/payments/new.html.haml
@@ -4,13 +4,12 @@
= 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"}
+ %input{:name => "amount", :placeholder => "#{t(:donation_amount)}", :type => "text"}
+ %input.btn.btn-primary{:type => "submit", :value => "#{t(:donate)}"}
%script{:src => "https://js.braintreegateway.com/v2/braintree.js"}
:javascript
var clientToken = "#{@client_token}";
diff --git a/engines/billing/app/views/subscriptions/index.html.erb b/engines/billing/app/views/subscriptions/index.html.erb
index 2037de3..688e371 100644
--- a/engines/billing/app/views/subscriptions/index.html.erb
+++ b/engines/billing/app/views/subscriptions/index.html.erb
@@ -1,33 +1,35 @@
<h2 class="mbs">Subscriptions</h2>
<br>
-<br>
-<div id="last"> Lastest Subscriptions:
- <% if params[:search] == "active" %>
- <%= render :partial => "subscriptions/subscription_details" %>
- <%# Add destroy, route %>
- <%=link_to "Unsubscribe", :show_subscription, class: "button" %>
- </div>
+<h4><div id="last"> Lastest Subscriptions:</h4>
+ <% if @user.subscription_id %>
+ <ul>
+ <% @subscription.transactions.each do |transaction| %>
+ <li>
+ Date: <%= transaction.created_at %>
+ </li>
+ <% end %>
+ </ul>
+ <ul>
+ <%= link_to "Unsubscribe from #{@plan.name}", unsubscribe_subscription_path(@subscription.plan_id), method: :delete, class: "btn btn-danger" %>
+ </ul>
+</div>
<br>
<% else %>
- <p> No subscriptions </p>
- <p>Choose subcription:</p>
+ <p> No subscriptions. </p>
+ <br>
+ <h4>Choose subcription:</h4>
<br>
<ul class="nav nav-tabs nav-stacked">
<% @subscriptions.each do |subscription| %>
<li>
- <div class="btn-group">
- <button class="btn"> <%= subscription.name %>
- <%= subscription.price %> </button>
+ <div class="well">
+ <%= subscription.name %>
+ <%= subscription.price %>
</div>
<div>
- <%=link_to "Subscribe", :show_subscription, class: "button" %>
+ <%= link_to "Choose", subscription_path(subscription.id), class: "btn btn-info" %>
</div> <br>
</li>
<% end %>
<% end %>
</ul>
-
-
-
-
-
diff --git a/engines/billing/app/views/subscriptions/show.html.erb b/engines/billing/app/views/subscriptions/show.html.erb
index f3c730d..92cf863 100644
--- a/engines/billing/app/views/subscriptions/show.html.erb
+++ b/engines/billing/app/views/subscriptions/show.html.erb
@@ -1,26 +1,22 @@
<script src="https://js.braintreegateway.com/v2/braintree.js"></script>
<h2 class="mbs">New Subscription
</h2>
-<br/>
-<%= simple_form_for :subscription, :url => :subscriptions, :id => "checkout-form-#{subscription.id}" do |f| %>
- <input name="plan_id" type="hidden" value="<%= subscription.id %>"></input>
+<%= simple_form_for :subscription, :url => subscribe_subscription_path(@plan.id), :id => "checkout-form" do |f| %>
<% if current_user and !current_user.has_payment_info? %>
<%= render 'customer_form'%>
<% end %>
<br/>
<p> Please enter payment details: </p>
- <div id="payment-form-<%= subscription.id %>"></div>
+ <div id="payment-form"></div>
+ <div id="coinbase-container-id"></div>
<div class="form-actions">
- <%= f.submit t(:choose), :class => 'btn btn-primary' %>
+ <%= f.submit t(:subscribe), :class => 'btn btn-primary' %>
</div>
<script charset="utf-8" type="text/javascript">
var clientToken = "<%= @client_token %>";
braintree.setup(clientToken, "dropin", {
- container: "payment-form-#{subscription.id}",
+ container: "payment-form",
coinbase: { container: "coinbase-container-id" }
});
</script>
- <% end %>
-<div id="payment-form"></div>
-<div id="coinbase-container-id"></div>
-
+<% end %>