From 7ac8253ee84bcb6185d6200572683ada6f632af8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=BCrlimann?= Date: Mon, 24 Mar 2014 22:31:45 +0100 Subject: [PATCH] Update i18n_rails_helpers and drop action views for admin tenant. --- Gemfile.lock | 2 +- app/controllers/admin/tenants_controller.rb | 11 +++++++++++ app/views/admin/tenants/index.html.haml | 5 ----- app/views/admin/tenants/new.html.haml | 6 ------ app/views/admin/tenants/show.html.haml | 7 ------- 5 files changed, 12 insertions(+), 19 deletions(-) delete mode 100644 app/views/admin/tenants/index.html.haml delete mode 100644 app/views/admin/tenants/new.html.haml delete mode 100644 app/views/admin/tenants/show.html.haml diff --git a/Gemfile.lock b/Gemfile.lock index dad37d4b..d6b2966c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -209,7 +209,7 @@ GEM http_parser.rb (0.5.3) httpauth (0.2.0) i18n (0.6.9) - i18n_rails_helpers (1.0.9) + i18n_rails_helpers (1.2.0) inherited_resources (1.4.0) has_scope (~> 0.5.0) responders (~> 0.9) diff --git a/app/controllers/admin/tenants_controller.rb b/app/controllers/admin/tenants_controller.rb index e1191a73..bdac62dd 100644 --- a/app/controllers/admin/tenants_controller.rb +++ b/app/controllers/admin/tenants_controller.rb @@ -9,6 +9,11 @@ def current_ability @current_ability ||= Ability.new(current_admin_user) end + # Redirect to the called path before the login + def after_sign_in_path_for(resource) + (session[:"user.return_to"].nil?) ? "/" : session[:"user.return_to"].to_s + end + # Actions # ======= def new @@ -41,4 +46,10 @@ def create render 'new' end end + + # Resource setup + protected + def collection + instance_eval("@#{controller_name.pluralize} ||= end_of_association_chain.accessible_by(current_ability, :list).paginate(:page => params[:page], :per_page => params[:per_page])") + end end diff --git a/app/views/admin/tenants/index.html.haml b/app/views/admin/tenants/index.html.haml deleted file mode 100644 index 7f357f55..00000000 --- a/app/views/admin/tenants/index.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -= contextual_links - -= boot_page_title - -= render 'list', :collection => collection diff --git a/app/views/admin/tenants/new.html.haml b/app/views/admin/tenants/new.html.haml deleted file mode 100644 index 4fc2c203..00000000 --- a/app/views/admin/tenants/new.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -.contextual - = contextual_link_to :index, [:admin, :tenants] - -= boot_page_title - -= render 'form' diff --git a/app/views/admin/tenants/show.html.haml b/app/views/admin/tenants/show.html.haml deleted file mode 100644 index 98ae1042..00000000 --- a/app/views/admin/tenants/show.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -.contextual - = contextual_link_to :index, [:admin, :tenants] - = contextual_link_to :delete, @tenant - -= boot_page_title - -= render "show"