From 8ac2e1eed9924d98c1836216b6fdecaf84eb0001 Mon Sep 17 00:00:00 2001 From: Yanick Minder Date: Tue, 6 Aug 2024 13:43:19 +0200 Subject: [PATCH] change name of cancel.svg and use correct language to display language --- app/assets/images/{x.svg => cancel.svg} | 0 app/assets/stylesheets/crud.scss | 2 +- app/helpers/auth_helper.rb | 11 ++++------- spec/features/routing_spec.rb | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) rename app/assets/images/{x.svg => cancel.svg} (100%) diff --git a/app/assets/images/x.svg b/app/assets/images/cancel.svg similarity index 100% rename from app/assets/images/x.svg rename to app/assets/images/cancel.svg diff --git a/app/assets/stylesheets/crud.scss b/app/assets/stylesheets/crud.scss index 12deef0b0..7587b432e 100644 --- a/app/assets/stylesheets/crud.scss +++ b/app/assets/stylesheets/crud.scss @@ -58,4 +58,4 @@ footer { .icon-list { background-image: url('assets/list.png'); } .icon-zoom-in { background-image: url('assets/search.svg'); } .icon-export { background-image: url('assets/export.svg'); } -.icon-close { background-image: url('assets/x.svg'); } +.icon-close { background-image: url('assets/cancel.svg'); } diff --git a/app/helpers/auth_helper.rb b/app/helpers/auth_helper.rb index 6490ee3c6..b4194fe2e 100644 --- a/app/helpers/auth_helper.rb +++ b/app/helpers/auth_helper.rb @@ -23,13 +23,10 @@ def devise? AuthConfig.keycloak? || Rails.env.test? end - def language_selector # rubocop:disable Metrics/AbcSize - languages = I18nData.languages(I18n.locale).to_a.map do |e| - [e.second.titleize, e.first.downcase.to_sym] - end - languages = languages.select { |e| I18n.available_locales.include? e.second } - languages = languages.map do |e| - [e.first, url_for(locale: e.second)] + def language_selector + languages = I18n.available_locales.map { |e| e.to_s }.map do |lang_code| + language = I18nData.languages(lang_code)[lang_code.upcase] + [language, url_for(locale: lang_code)] end options_for_select(languages, url_for(locale: I18n.locale)) end diff --git a/spec/features/routing_spec.rb b/spec/features/routing_spec.rb index cf9e71d7b..b227fe5d7 100644 --- a/spec/features/routing_spec.rb +++ b/spec/features/routing_spec.rb @@ -29,7 +29,7 @@ context "Set locale via dropdown" do before(:each) do visit people_path - select 'Italienisch', from: "i18n_language" + select 'Italiano', from: "i18n_language" default_url_options[:locale] = :it end