continue to backport old code
This commit is contained in:
@@ -2,7 +2,7 @@ class ApplicationController < ActionController::Base
|
||||
around_action :switch_locale
|
||||
|
||||
def switch_locale(&action)
|
||||
locale = I18n.default_locale
|
||||
locale = I18n.locale_available?(request.headers['Locale']) ? request.headers['Locale'] : I18n.default_locale
|
||||
I18n.with_locale(locale, &action)
|
||||
end
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
class ProtectedController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
before_action :authenticate_user!
|
||||
end
|
||||
|
||||
@@ -11,6 +11,9 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
||||
|
||||
if @user.persisted?
|
||||
sign_in_and_redirect @user, event: :authentication
|
||||
WowCharactersWorker.perform_async(@user.id)
|
||||
WowMountsCollectionWorker.perform_async(@user.id)
|
||||
WowPetsCollectionWorker.perform_async(@user.id)
|
||||
set_flash_message(:notice, :success, kind: 'Bnet') if is_navigational_format?
|
||||
else
|
||||
session['devise.bnet_data'] = request.env['omniauth.auth'].except(:extra)
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
class WowCharactersController < ProtectedController
|
||||
def index
|
||||
@characters = current_user.wow_characters.all
|
||||
@wow_characters = current_user.wow_characters.all
|
||||
end
|
||||
|
||||
def show
|
||||
@wow_character = current_user.wow_characters.find(params[:id])
|
||||
end
|
||||
end
|
||||
|
||||
9
app/controllers/wow_mounts_controller.rb
Normal file
9
app/controllers/wow_mounts_controller.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class WowMountsController < ProtectedController
|
||||
def index
|
||||
@wow_mounts = WowMount.all
|
||||
end
|
||||
|
||||
def show
|
||||
@wow_mount = WowMount.find(params[:id])
|
||||
end
|
||||
end
|
||||
9
app/controllers/wow_pets_controller.rb
Normal file
9
app/controllers/wow_pets_controller.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class WowPetsController < ProtectedController
|
||||
def index
|
||||
@wow_pets = WowPet.all
|
||||
end
|
||||
|
||||
def show
|
||||
@wow_pet = WowPet.find(params[:id])
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user