From c4d7b3bbda52e8fe801ddda908bb10ff87db3158 Mon Sep 17 00:00:00 2001 From: Jessica Dussault Date: Tue, 17 Nov 2020 14:34:49 -0600 Subject: [PATCH 1/2] renames languages config to all_languages this prevents orchid from using gsub to accidentally setting the languages facet field lower in the public.yml file, which results in invalid yaml --- CHANGELOG.md | 6 ++++- app/helpers/orchid/application_helper.rb | 4 ++-- app/views/layouts/body/_languages.html.erb | 2 +- app/views/layouts/head/_language.html.erb | 5 +++-- lib/generators/setup_generator.rb | 26 +++++++++++++--------- lib/generators/templates/public.yml | 2 +- lib/orchid/routing.rb | 4 ++-- 7 files changed, 30 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a59fd53e..5686aee8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ Versioning](https://semver.org/spec/v2.0.0.html). ### Fixed - bug with locales yaml creation +- es locale file will be copied into app if Spanish requested ### Added - partials for browse, browse_facet, index, and search_preset header content for easier overriding @@ -44,8 +45,11 @@ Versioning](https://semver.org/spec/v2.0.0.html). - `language` (head) ### Changed -- `ALL_LANGUAGES` setting changed back to `languages` - language documentation clarified and expanded +- references to `APP_OPTS["languages"]` changed to use `all_languages` + +### Migration +- rename `languages` and `ALL_LANGUAGES` to `all_languages` in `public.yml` file ## [v3.1.0](https://github.com/CDRH/orchid/compare/v3.0.3...v3.1.0) - search_preset, improved section links, and misc display diff --git a/app/helpers/orchid/application_helper.rb b/app/helpers/orchid/application_helper.rb index e31ccb0e..d53266d5 100644 --- a/app/helpers/orchid/application_helper.rb +++ b/app/helpers/orchid/application_helper.rb @@ -182,8 +182,8 @@ def locale end def locale_link(lang_code) - locales = APP_OPTS["languages"].split("|") - .reject { |l| l == APP_OPTS["language_default"] }.join("|") + locales = APP_OPTS["all_languages"].split("|") + .reject { |l| l == APP_OPTS["all_language_default"] }.join("|") url = request.fullpath if lang_code == APP_OPTS["language_default"] diff --git a/app/views/layouts/body/_languages.html.erb b/app/views/layouts/body/_languages.html.erb index d66308c5..fb30b0f4 100644 --- a/app/views/layouts/body/_languages.html.erb +++ b/app/views/layouts/body/_languages.html.erb @@ -1,4 +1,4 @@ -<% langs = APP_OPTS["languages"] %> +<% langs = APP_OPTS["all_languages"] %> <% if langs.present? && langs[/\|/] %>