From d3e4489cc4833c196eeef77f4fe0680c3f7e7a09 Mon Sep 17 00:00:00 2001 From: jessib Date: Tue, 11 Jun 2013 12:16:13 -0700 Subject: More cleanup of billing code. --- .../app/views/subscriptions/_subscription_details.html.haml | 12 ++++++++---- billing/app/views/subscriptions/create.html.haml | 1 + billing/app/views/subscriptions/destroy.html.haml | 4 +++- billing/app/views/subscriptions/index.html.haml | 7 ++++++- billing/app/views/subscriptions/show.html.haml | 5 ++++- 5 files changed, 22 insertions(+), 7 deletions(-) (limited to 'billing/app/views/subscriptions') diff --git a/billing/app/views/subscriptions/_subscription_details.html.haml b/billing/app/views/subscriptions/_subscription_details.html.haml index db9d75b..fb18210 100644 --- a/billing/app/views/subscriptions/_subscription_details.html.haml +++ b/billing/app/views/subscriptions/_subscription_details.html.haml @@ -6,10 +6,14 @@ = subscription.billing_day_of_month Start date: = subscription.first_billing_date - Paid through + Paid through: = subscription.paid_through_date - Price + Plan: + = subscription.plan_id + Price: = subscription.price - Status - = subscription.status + - color = (subscription.status == 'Active') ? "green" : "red" + Status: + %font{:color => color} + = subscription.status - # would be good to get plan name but not sure if that is possible? \ No newline at end of file diff --git a/billing/app/views/subscriptions/create.html.haml b/billing/app/views/subscriptions/create.html.haml index e0585ab..2b6c5e9 100644 --- a/billing/app/views/subscriptions/create.html.haml +++ b/billing/app/views/subscriptions/create.html.haml @@ -2,6 +2,7 @@ %h1 Subscription Status = @result.subscription.status + = render :partial => "subscription_details", :locals => {:subscription => @result.subscription} - else %h1 Error: diff --git a/billing/app/views/subscriptions/destroy.html.haml b/billing/app/views/subscriptions/destroy.html.haml index f888e6d..e7ed6e8 100644 --- a/billing/app/views/subscriptions/destroy.html.haml +++ b/billing/app/views/subscriptions/destroy.html.haml @@ -2,4 +2,6 @@ Subscription destroyed - else Error: - = @result.message \ No newline at end of file + = @result.message +%p + = link_to 'Customer Information', show_customer_path(@customer.braintree_customer_id), :class=> :btn \ No newline at end of file diff --git a/billing/app/views/subscriptions/index.html.haml b/billing/app/views/subscriptions/index.html.haml index c885f90..0e84619 100644 --- a/billing/app/views/subscriptions/index.html.haml +++ b/billing/app/views/subscriptions/index.html.haml @@ -1,2 +1,7 @@ +- active = false - @subscriptions.each do |s| - = render :partial => "subscription_details", :locals => {:subscription => s} \ No newline at end of file + - if s.status == 'Active' + - active = true + = render :partial => "subscription_details", :locals => {:subscription => s} +- if !active + = link_to 'subscribe to plan', new_subscription_path, :class => :btn \ No newline at end of file diff --git a/billing/app/views/subscriptions/show.html.haml b/billing/app/views/subscriptions/show.html.haml index a3d57f9..6f108be 100644 --- a/billing/app/views/subscriptions/show.html.haml +++ b/billing/app/views/subscriptions/show.html.haml @@ -1,4 +1,7 @@ -%h1 Current Subscription +%h1 + - if @subscription.status == 'Active' + Current + Subscription = render :partial => "subscription_details", :locals => {:subscription => @subscription} = link_to 'Cancel Subscription', subscription_path, :confirm => 'Are you sure you want to cancel this subscription?', :method => :delete, :class => 'btn btn-danger' if @subscription.status == 'Active' # permission check or should that just be on show? = link_to 'Show Customer Data', show_customer_path(@subscription_customer_id), :class => :btn \ No newline at end of file -- cgit v1.2.3