Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added localize parameters to url #1119

Merged
merged 2 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ group :test do
gem 'capybara', '>= 2.15'
gem 'simplecov', '~> 0.10', '< 0.18', require: false
gem 'spy'
gem 'webdrivers'
gem 'selenium-webdriver'
gem 'webmock'
end

Expand Down
6 changes: 1 addition & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,6 @@ GEM
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
webdrivers (5.2.0)
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
selenium-webdriver (~> 4.0)
webfinger (1.2.0)
activesupport
httpclient (>= 2.4)
Expand Down Expand Up @@ -479,14 +475,14 @@ DEPENDENCIES
rubocop-performance
ruby-openai
scenic
selenium-webdriver
simplecov (~> 0.10, < 0.18)
simpleidn
skylight
sprockets (~> 4.0)
spy
turbo-rails
web-console (>= 3.3.0)
webdrivers
webmock
webpacker (~> 6.0.0.rc.5)
webpush
Expand Down
6 changes: 5 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ class ApplicationController < ActionController::Base
policy.style_src :self, 'www.gstatic.com', :unsafe_inline
end

rescue_from CanCan::AccessDenied do |exception|
rescue_from CanCan::AccessDenied do |_exception|
flash[:alert] = I18n.t('unauthorized.message')
redirect_to root_url
end

def set_locale
if params[:localize].present? && I18n.available_locales.include?(params[:localize].to_sym)
cookies[:locale] = params[:localize]
end

I18n.locale = current_user&.locale || cookies[:locale] || I18n.default_locale
@pagy_locale = I18n.locale.to_s
end
Expand Down
5 changes: 0 additions & 5 deletions test/application_system_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase

include SemanticUiHelper

# 115.0.5790
Webdrivers::Chromedriver.required_version = '114.0.5735.90'

Capybara.register_driver(:headless_chrome) do |app|
options = ::Selenium::WebDriver::Chrome::Options.new
options.add_argument('--headless')
Expand All @@ -20,8 +17,6 @@ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
end

Webdrivers::Chromedriver.required_version = '114.0.5735.90'

driven_by :headless_chrome
Capybara.server = :puma, { Silent: true }

Expand Down
Loading