Signed-off-by: Adrian Hinz <adhinz@gmail.com>
This commit is contained in:
parent
257631ea27
commit
7a98865b26
|
|
@ -3,19 +3,11 @@ class ApplicationController < ActionController::Base
|
||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
before_action :set_locale
|
before_action :set_locale
|
||||||
layout :layout_by_resource
|
layout :layout_by_resource
|
||||||
after_action :set_headers
|
|
||||||
|
|
||||||
def set_locale
|
def set_locale
|
||||||
I18n.locale = params[:lang] || I18n.default_locale
|
I18n.locale = params[:lang] || I18n.default_locale
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_headers
|
|
||||||
headers['Access-Control-Allow-Origin'] = '*'
|
|
||||||
headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'
|
|
||||||
headers['Access-Control-Request-Method'] = '*'
|
|
||||||
headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'
|
|
||||||
end
|
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def layout_by_resource
|
def layout_by_resource
|
||||||
|
|
|
||||||
|
|
@ -13,14 +13,6 @@ module InvoiceKeeper
|
||||||
# -- all .rb files in that directory are automatically loaded.
|
# -- all .rb files in that directory are automatically loaded.
|
||||||
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s]
|
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s]
|
||||||
config.i18n.default_locale = :pl
|
config.i18n.default_locale = :pl
|
||||||
config.action_dispatch.default_headers.merge!({'X-Frame-Options' => 'ALLOWALL'})
|
|
||||||
config.middleware.insert_before 0, Rack::Cors do
|
|
||||||
allow do
|
|
||||||
origins '*'
|
|
||||||
resource '*', :headers => :any, :methods => [:get, :post, :options]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
|
config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
|
||||||
config.assets.precompile += %w( .svg .eot .woff .ttf .otf .woff2 )
|
config.assets.precompile += %w( .svg .eot .woff .ttf .otf .woff2 )
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue