From 6f5e2c2cdcbdb9ea4aca71f0bde2a935d979da3f Mon Sep 17 00:00:00 2001 From: jessib Date: Tue, 6 Aug 2013 14:21:08 -0700 Subject: Some more tweaks to have billing code work, and allow admins to view but not edit for other users. --- billing/app/views/credit_card_info/edit.html.haml | 2 +- billing/app/views/customer/confirm.html.haml | 2 +- billing/app/views/customer/show.html.haml | 4 ++-- billing/app/views/payments/_customer_data.html.haml | 3 ++- billing/app/views/payments/index.html.haml | 1 + billing/app/views/subscriptions/_subscription_details.html.haml | 2 +- billing/app/views/subscriptions/index.html.haml | 3 ++- 7 files changed, 10 insertions(+), 7 deletions(-) (limited to 'billing/app/views') diff --git a/billing/app/views/credit_card_info/edit.html.haml b/billing/app/views/credit_card_info/edit.html.haml index 39269ca..bd86a4c 100644 --- a/billing/app/views/credit_card_info/edit.html.haml +++ b/billing/app/views/credit_card_info/edit.html.haml @@ -14,4 +14,4 @@ %dd= f.text_field :cvv = hidden_field_tag :tr_data, @tr_data = f.submit 'Save Payment Info', :class => :btn - = link_to t(:cancel), edit_customer_path(@credit_card.customer_id), :class => :btn + = link_to t(:cancel), edit_customer_path(@user.id), :class => :btn diff --git a/billing/app/views/customer/confirm.html.haml b/billing/app/views/customer/confirm.html.haml index 5551622..49a1e91 100644 --- a/billing/app/views/customer/confirm.html.haml +++ b/billing/app/views/customer/confirm.html.haml @@ -11,4 +11,4 @@ - @result.customer.credit_cards.each do |cc| %dd= cc.masked_number - customer = Customer.find_by_user_id(current_user.id) -= link_to 'View Customer Info', show_customer_path(customer.braintree_customer_id), :class=> :btn \ No newline at end of file += link_to 'View Customer Info', show_customer_path(@user.id), :class=> :btn \ No newline at end of file diff --git a/billing/app/views/customer/show.html.haml b/billing/app/views/customer/show.html.haml index 38b1cb2..243bd3b 100644 --- a/billing/app/views/customer/show.html.haml +++ b/billing/app/views/customer/show.html.haml @@ -12,7 +12,7 @@ - break if counter > 2 # not ruby-like, but object is a Braintree::ResourceCollection so limited methods available = render :partial => "payments/transaction_details", :locals => {:transaction => t} - counter += 1 - = link_to t(:transaction_history), payments_path + = link_to t(:transaction_history), user_payments_path(@user) %legend= t(:subscriptions) - if @active_subscription = render :partial => "subscriptions/subscription_details", :locals => {:subscription => @active_subscription} @@ -24,4 +24,4 @@ .form-actions = link_to t(:subscribe_to_plan), new_subscription_path, :class => :btn %p - = link_to t(:all_subscriptions), subscriptions_path + = link_to t(:all_subscriptions), user_subscriptions_path(@user) diff --git a/billing/app/views/payments/_customer_data.html.haml b/billing/app/views/payments/_customer_data.html.haml index 87b8209..e9df040 100644 --- a/billing/app/views/payments/_customer_data.html.haml +++ b/billing/app/views/payments/_customer_data.html.haml @@ -12,4 +12,5 @@ %dd= @default_cc.masked_number %dt Expiration Date %dd= @default_cc.expiration_date - = link_to t(:edit_saved_data), edit_customer_path(@customer), :class => :btn + - if current_user == @user + = link_to t(:edit_saved_data), edit_customer_path(@user.id), :class => :btn diff --git a/billing/app/views/payments/index.html.haml b/billing/app/views/payments/index.html.haml index f994fe5..7a89917 100644 --- a/billing/app/views/payments/index.html.haml +++ b/billing/app/views/payments/index.html.haml @@ -1,3 +1,4 @@ +%h2=t :transaction_history - if (@transactions.count == 0) = t(:no_transaction_history) - @transactions.each do |t| diff --git a/billing/app/views/subscriptions/_subscription_details.html.haml b/billing/app/views/subscriptions/_subscription_details.html.haml index fb18210..6eda7ca 100644 --- a/billing/app/views/subscriptions/_subscription_details.html.haml +++ b/billing/app/views/subscriptions/_subscription_details.html.haml @@ -1,5 +1,5 @@ %p - = link_to subscription.id, subscription_path(subscription.id) + = link_to subscription.id, user_subscription_path(@user, subscription.id) Balance: = number_to_currency(subscription.balance) Bill on: diff --git a/billing/app/views/subscriptions/index.html.haml b/billing/app/views/subscriptions/index.html.haml index 0e84619..87771e5 100644 --- a/billing/app/views/subscriptions/index.html.haml +++ b/billing/app/views/subscriptions/index.html.haml @@ -1,7 +1,8 @@ +%h2=t :all_subscriptions - active = false - @subscriptions.each do |s| - if s.status == 'Active' - active = true = render :partial => "subscription_details", :locals => {:subscription => s} -- if !active +- if !active and @user == current_user = link_to 'subscribe to plan', new_subscription_path, :class => :btn \ No newline at end of file -- cgit v1.2.3