summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--billing/app/helpers/billing_helper.rb13
-rw-r--r--billing/app/views/billing_admin/show.html.haml14
-rw-r--r--billing/app/views/subscriptions/_subscription_details.html.haml9
3 files changed, 19 insertions, 17 deletions
diff --git a/billing/app/helpers/billing_helper.rb b/billing/app/helpers/billing_helper.rb
index 1dd3f38..68ed5b8 100644
--- a/billing/app/helpers/billing_helper.rb
+++ b/billing/app/helpers/billing_helper.rb
@@ -46,4 +46,17 @@ module BillingHelper
end
+ def show_set_user_subscriptions(set)
+ if set.empty?
+ return t(:none)
+ else
+ subscriptions_to_display = ''
+ set.each do |past_due_subscription|
+ subscriptions_to_display += render :partial => "subscriptions/subscription_details", :locals => {:subscription => past_due_subscription, :show_user => user_for_subscription(past_due_subscription)}
+ end
+ subscriptions_to_display.html_safe
+ end
+ end
+
+
end
diff --git a/billing/app/views/billing_admin/show.html.haml b/billing/app/views/billing_admin/show.html.haml
index 78843e5..a275a5e 100644
--- a/billing/app/views/billing_admin/show.html.haml
+++ b/billing/app/views/billing_admin/show.html.haml
@@ -1,17 +1,9 @@
-- # todo: move into helper, as following 2 are pretty much identical
+- # todo: move into helper, as following 2 are pretty much identical (show_set_user_subscriptions is started)
%legend= t(:more_than_90_days_past_due)
-- if @past_due_atleast_90_days.empty?
- = t(:none)
-- else
- - @past_due_atleast_90_days.each do |past_due_subscription|
- = render :partial => "subscriptions/subscription_details", :locals => {:subscription => past_due_subscription, :show_user => user_for_subscription(past_due_subscription)}
+= show_set_user_subscriptions(@past_due_atleast_90_days)
%legend= t(:all_past_due)
-- if @all_past_due.empty?
- = t(:none)
-- else
- - @all_past_due.each do |past_due_subscription|
- = render :partial => "subscriptions/subscription_details", :locals => {:subscription => past_due_subscription, :show_user => user_for_subscription(past_due_subscription)}
+= show_set_user_subscriptions(@all_past_due)
%legend= t(:your_settings)
= link_to 'view own billing settings', show_or_new_customer_link(current_user) \ No newline at end of file
diff --git a/billing/app/views/subscriptions/_subscription_details.html.haml b/billing/app/views/subscriptions/_subscription_details.html.haml
index 27b00c7..fcf4bc4 100644
--- a/billing/app/views/subscriptions/_subscription_details.html.haml
+++ b/billing/app/views/subscriptions/_subscription_details.html.haml
@@ -5,12 +5,9 @@
ID:
= link_to subscription.id, user_subscription_path(@user, subscription.id)
Balance:
- - subscription_balance_currency = number_to_currency(subscription.balance)
- - if subscription.balance > 0
- %font{:color => "red"}
- = subscription_balance_currency
- - else
- = subscription_balance_currency
+ - color = (subscription.balance > 0) ? "red" : ""
+ %font{:color => color}
+ = number_to_currency(subscription.balance)
Bill on:
= subscription.billing_day_of_month
Start date: