Add links to diaries in preferred languages

This commit is contained in:
Anton Khorev 2024-01-02 08:09:35 +03:00
parent d6827e6e96
commit f4d84c4806
3 changed files with 19 additions and 0 deletions

View file

@ -47,6 +47,8 @@ class DiaryEntriesController < ApplicationController
@title = t ".in_language_title", :language => Language.find(params[:language]).english_name
entries = entries.where(:language_code => params[:language])
else
candidate_codes = preferred_languages.flat_map(&:candidates).uniq.map(&:to_s)
@languages = Language.where(:code => candidate_codes).in_order_of(:code, candidate_codes)
@title = t ".title"
end
end