continue to backport old code

This commit is contained in:
2021-04-24 00:24:05 +02:00
parent 5d7217f355
commit 04434760c5
72 changed files with 795 additions and 78 deletions

View File

@@ -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

View File

@@ -1,3 +1,3 @@
class ProtectedController < ApplicationController
before_action :authenticate_user!
before_action :authenticate_user!
end

View File

@@ -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)

View File

@@ -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

View 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

View 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