From 4a46b14c29a3d5324ad75d79d56a8f8ccfbafba4 Mon Sep 17 00:00:00 2001 From: Markus Graf Date: Thu, 21 Apr 2016 16:53:30 +0200 Subject: [PATCH] makeup --- app/controllers/admin/application_controller.rb | 6 ++++-- app/controllers/admin/pages_controller.rb | 8 +++++--- app/controllers/admin/supporters_controller.rb | 8 +++++--- app/controllers/application_controller.rb | 6 +++--- config/routes.rb | 4 ++-- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/app/controllers/admin/application_controller.rb b/app/controllers/admin/application_controller.rb index e4a7f9c..4de6421 100644 --- a/app/controllers/admin/application_controller.rb +++ b/app/controllers/admin/application_controller.rb @@ -1,3 +1,5 @@ -class Admin::ApplicationController < ApplicationController - http_basic_authenticate_with name: 'admin', password: ENV['ADMIN_PASSWORD'] unless Rails.env.development? +module Admin + class ApplicationController < ApplicationController + http_basic_authenticate_with name: 'admin', password: ENV['ADMIN_PASSWORD'] unless Rails.env.development? + end end diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb index addb77d..4e73e5b 100644 --- a/app/controllers/admin/pages_controller.rb +++ b/app/controllers/admin/pages_controller.rb @@ -1,5 +1,7 @@ -class Admin::PagesController < Admin::ApplicationController - def map - @supporters = Supporter.where(:coordinates.ne => nil).only(:coordinates, :support) +module Admin + class PagesController < Admin::ApplicationController + def map + @supporters = Supporter.where(:coordinates.ne => nil).only(:coordinates, :support) + end end end diff --git a/app/controllers/admin/supporters_controller.rb b/app/controllers/admin/supporters_controller.rb index 03f4af2..8965d4a 100644 --- a/app/controllers/admin/supporters_controller.rb +++ b/app/controllers/admin/supporters_controller.rb @@ -1,5 +1,7 @@ -class Admin::SupportersController < Admin::ApplicationController - def index - @supporters = Supporter.desc(:created_at) +module Admin + class SupportersController < Admin::ApplicationController + def index + @supporters = Supporter.desc(:created_at) + end end end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0f5ab39..f5e3894 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,7 +2,7 @@ class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception - + before_action :set_locale INPUT_TIMEOUT = 2.seconds # We estimate that a user needs more then x seconds to enter some informations @@ -18,11 +18,11 @@ class ApplicationController < ActionController::Base def set_form_timestamp session[:form_timestamp] = Time.now end - + def set_locale I18n.locale = params[:locale] || I18n.default_locale end - + # I18n set default language in url def default_url_options(options = {}) options.merge locale: I18n.locale diff --git a/config/routes.rb b/config/routes.rb index 2460eae..31f5d3f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,12 +1,12 @@ Rails.application.routes.draw do root 'supporters#new' - scope "/:locale" do + scope '/:locale' do get '/', to: 'supporters#new' resources :supporters get '/thanks', to: 'pages#thanks', as: :thanks end - + get '/cities_autocomplete', to: 'cities_autocomplete#index', as: :cities_autocomplete namespace :admin do