From 979aa417aa722c5e550219bff90ec757ac098a0f Mon Sep 17 00:00:00 2001 From: jessib Date: Tue, 23 Jul 2013 13:26:55 -0700 Subject: Some clean-up of billing display. --- app/views/home/index.html.haml | 2 ++ billing/app/views/customer/edit.html.haml | 9 +++++---- billing/app/views/customer/show.html.haml | 18 ++++++++++-------- billing/app/views/payments/_customer_data.html.haml | 7 ++++--- billing/app/views/subscriptions/new.html.haml | 7 ++++--- billing/app/views/subscriptions/show.html.haml | 3 +-- billing/config/locales/en.yml | 5 +++++ 7 files changed, 31 insertions(+), 20 deletions(-) create mode 100644 billing/config/locales/en.yml diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml index 8c90436..9b82cf3 100644 --- a/app/views/home/index.html.haml +++ b/app/views/home/index.html.haml @@ -10,3 +10,5 @@ %hr %p = link_to "fetch a cert", cert_path + +- # TODO: will want link to donation (anonymous payment), which is new_payment_path \ No newline at end of file diff --git a/billing/app/views/customer/edit.html.haml b/billing/app/views/customer/edit.html.haml index 76c678b..8a232c5 100644 --- a/billing/app/views/customer/edit.html.haml +++ b/billing/app/views/customer/edit.html.haml @@ -13,10 +13,11 @@ %dd= f.text_field :phone - if @default_cc = # todo, as they will need a credit card, so not sure about conditional? - %dt Stored Credit Card + %dt= t(:stored_credit_card) %dd = @default_cc.masked_number - = link_to 'Change credit card', edit_credit_card_info_path(:id => @default_cc.token), :class => :btn + = link_to t(:change_credit_card), edit_credit_card_info_path(:id => @default_cc.token), :class => :btn = hidden_field_tag :tr_data, @tr_data - = f.submit 'Save Customer Info', :class => :btn -= link_to 'Show Customer Information', show_customer_path(@customer), :class=> :btn + .form-actions + = f.submit t(:save_customer_info), :class => 'btn btn-primary' + = link_to t(:cancel), show_customer_path(@customer), :class=> :btn diff --git a/billing/app/views/customer/show.html.haml b/billing/app/views/customer/show.html.haml index 8ef5517..639d180 100644 --- a/billing/app/views/customer/show.html.haml +++ b/billing/app/views/customer/show.html.haml @@ -1,20 +1,22 @@ +.form-actions + = link_to t(:make_payment), new_payment_path, :class => 'btn btn-primary' = render :partial => 'payments/customer_data' -= link_to 'Make Payment', new_payment_path, :class => :btn -%h3 Last three transactions +%legend= t(:last_three_transactions) - counter = 0 = # these will be ordered with most recently created first, per http://stackoverflow.com/questions/16425475/ -- @braintree_data.transactions.each do |t| +- @transactions.each do |t| - 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 'Transaction History', payments_path -%h3 Subscriptions += link_to t(:transaction_history), payments_path +%legend= t(:subscriptions) - if @active_subscription = render :partial => "subscriptions/subscription_details", :locals => {:subscription => @active_subscription} - else %p - No active subscription + = t(:no_active_subscription) %p - = link_to 'subscribe to plan', new_subscription_path, :class => :btn + .form-actions + = link_to t(:subscribe_to_plan), new_subscription_path, :class => :btn %p - = link_to 'All subscriptions', subscriptions_path + = link_to t(:all_subscriptions), subscriptions_path diff --git a/billing/app/views/payments/_customer_data.html.haml b/billing/app/views/payments/_customer_data.html.haml index 71a5eaf..f6c82a1 100644 --- a/billing/app/views/payments/_customer_data.html.haml +++ b/billing/app/views/payments/_customer_data.html.haml @@ -1,4 +1,4 @@ -%h2 Customer Information +%legend= t(:customer_information) %dl %dt First Name %dd= @customer.first_name @@ -6,10 +6,11 @@ %dd= @customer.last_name %dt Phone %dd= @customer.phone -%h2 Credit Card Information +%legend= t(:credit_card_information) %dl %dt Number %dd= @default_cc.masked_number %dt Expiration Date %dd= @default_cc.expiration_date -= link_to 'Edit Saved Data', edit_customer_path(@customer), :class => :btn +.form-actions + = link_to t(:edit_saved_data), edit_customer_path(@customer), :class => :btn diff --git a/billing/app/views/subscriptions/new.html.haml b/billing/app/views/subscriptions/new.html.haml index dba5f53..4183458 100644 --- a/billing/app/views/subscriptions/new.html.haml +++ b/billing/app/views/subscriptions/new.html.haml @@ -7,8 +7,9 @@ = 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 - = f.submit 'Subscribe' + .form-actions + = f.submit t(:subscribe), :class => 'btn btn-primary' - else - You must store a customer in braintree before subscribing to a plan + = t(:must_create_customer) %p - = link_to 'Create a new braintree customer', new_customer_path + = link_to t(:create_new_customer), new_customer_path diff --git a/billing/app/views/subscriptions/show.html.haml b/billing/app/views/subscriptions/show.html.haml index 6f108be..10eb667 100644 --- a/billing/app/views/subscriptions/show.html.haml +++ b/billing/app/views/subscriptions/show.html.haml @@ -3,5 +3,4 @@ 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 += link_to t(:cancel_subscription), subscription_path, :confirm => t(:are_you_sure), :method => :delete, :class => 'btn btn-danger' if @subscription.status == 'Active' # permission check or should that just be on show? diff --git a/billing/config/locales/en.yml b/billing/config/locales/en.yml new file mode 100644 index 0000000..5245b17 --- /dev/null +++ b/billing/config/locales/en.yml @@ -0,0 +1,5 @@ +en: + create_new_customer: "Create a new Braintree Customer" + must_create_customer: "You must store a customer in braintree before subscribing to a plan" + subscribe: "Subscribe" + save_customer_info: "Save Customer Information" \ No newline at end of file -- cgit v1.2.3