diff options
| author | jessib <jessib@riseup.net> | 2013-08-13 10:37:31 -0700 | 
|---|---|---|
| committer | jessib <jessib@riseup.net> | 2013-08-13 10:37:31 -0700 | 
| commit | d0a15a50e1fdf08f2283562453d4e803aa7b31c8 (patch) | |
| tree | 422cabeee1629d823a91e3415d8abf53f44214aa | |
| parent | 1bdf34b4bda5af84bd6df44d4e718ea19667682c (diff) | |
Option to disable billing engine and hide billing related links. To actual disable, must remove billing engine from Gemfile (and re-bundle)
| -rw-r--r-- | app/helpers/application_helper.rb | 5 | ||||
| -rw-r--r-- | app/views/layouts/_navigation.html.haml | 2 | ||||
| -rw-r--r-- | common_dependencies.rb | 4 | ||||
| -rw-r--r-- | users/app/views/overviews/show.html.haml | 2 | 
4 files changed, 9 insertions, 4 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1e79990..cdc34ea 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -37,4 +37,9 @@ module ApplicationHelper      html_escape(msg).gsub('[b]', '<b>').gsub('[/b]', '</b>').html_safe    end +  def engine_enabled(name) +    # to disable engine, comment it out in Gemfile (and make sure to re-run bundle install) +    Rails::Application::Railties.engines.any? {|eng| eng.class.to_s == "#{name}::Engine"} +  end +  end diff --git a/app/views/layouts/_navigation.html.haml b/app/views/layouts/_navigation.html.haml index cd37ffa..3eb2289 100644 --- a/app/views/layouts/_navigation.html.haml +++ b/app/views/layouts/_navigation.html.haml @@ -3,5 +3,5 @@    = link_to_navigation t(:account_settings), edit_user_path(@user), :active => controller?(:users)    = link_to_navigation t(:email_settings), edit_user_email_settings_path(@user), :active => controller?(:email_settings)    = link_to_navigation t(:support_tickets), auto_tickets_path, :active => controller?(:tickets) -  = link_to_navigation t(:billing_settings), show_or_new_customer_link(@user), :active => controller?(:customer, :payments, :subscriptions, :credit_card_info) +  = link_to_navigation t(:billing_settings), show_or_new_customer_link(@user), :active => controller?(:customer, :payments, :subscriptions, :credit_card_info) if engine_enabled('LeapWebBilling')    = link_to_navigation t(:logout), logout_path, :method => :delete diff --git a/common_dependencies.rb b/common_dependencies.rb index 4790ea4..c795d66 100644 --- a/common_dependencies.rb +++ b/common_dependencies.rb @@ -10,11 +10,11 @@ group :test do    # required for save_and_open_page in integration tests    # gem 'launchy'    gem 'fake_braintree' #depends on rspec? +  gem 'faker' +  gem 'factory_girl_rails'  end  group :test, :development do -  gem 'faker' -  gem 'factory_girl_rails'    gem 'thin'    gem 'quiet_assets'  end diff --git a/users/app/views/overviews/show.html.haml b/users/app/views/overviews/show.html.haml index c6b079d..e43a193 100644 --- a/users/app/views/overviews/show.html.haml +++ b/users/app/views/overviews/show.html.haml @@ -19,4 +19,4 @@      %li= icon('user') + link_to(t(:overview_account), edit_user_path(@user))      %li= icon('envelope') + link_to(t(:overview_email), edit_user_email_settings_path(@user))      %li= icon('question-sign') + link_to(t(:overview_tickets), user_tickets_path(@user)) -    %li= icon('shopping-cart') + link_to(t(:overview_billing), show_or_new_customer_link(@user)) +    %li= icon('shopping-cart') + link_to(t(:overview_billing), show_or_new_customer_link(@user)) if engine_enabled('LeapWebBilling')  | 
