Skip to content
Snippets Groups Projects
Unverified Commit 08a6e7fb authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

feedback

parent e1f03c7b
No related branches found
No related tags found
No related merge requests found
......@@ -70,6 +70,10 @@ class Admin::Education::Programs::RolesController < Admin::Education::Programs::
end
def load_administration_people
@administration_people = current_university.people.for_language_id(current_university.default_language_id).administration.accessible_by(current_ability).ordered
@administration_people = current_university.people
.for_language_id(current_university.default_language_id)
.administration
.accessible_by(current_ability)
.ordered
end
end
class Admin::University::People::TranslationsController < Admin::University::ApplicationController
load_and_authorize_resource :person,
class: University::Person,
id_param: :person_id,
through: :current_university,
through_association: :people,
parent: false
def show
language = Language.find_by!(iso_code: params[:lang])
# Early return if language is correct
return [:admin, @person] if @person.language_id == language.id
# Look up for translation or translate (with blocks and all) from person
translation = @person.find_or_translate!(language)
# Redirect to the translation
redirect_to [:admin, translation.becomes(translation.class.base_class)]
end
end
......@@ -18,6 +18,12 @@ class Admin::University::PeopleController < Admin::University::ApplicationContro
breadcrumb
end
def in_language
language = Language.find_by!(iso_code: params[:lang])
translation = @person.find_or_translate!(language)
redirect_to [:admin, translation.becomes(translation.class.base_class)]
end
def static
@about = @person
@website = @person.websites&.first
......
......@@ -6,6 +6,7 @@ module Communication::Website::WithProgramCategories
end
# TODO : I18n
# Actuellement, on ne crée que dans la langue par défaut du website, on ne gère pas les autres langues
def set_programs_categories!
programs_root_category = categories.for_language_id(default_language_id).where(is_programs_root: true).first_or_create(
name: 'Offre de formation',
......
<% if about.available_languages.many? %>
<%
route_args = about.respond_to?(:website) ? [:admin, about.becomes(about.class.base_class)]
: [:admin, about.becomes(about.class.base_class), :translation]
: [:show_in_language, :admin, about.becomes(about.class.base_class)]
%>
<%= osuny_panel t('internationalization.label') do %>
<ol class="list-unstyled">
......
......@@ -20,9 +20,9 @@ namespace :university do
end
end
resources :people do
resources :translations, only: :show, param: :lang, controller: "people/translations"
member do
get :static
get "/translations/:lang" => "people#in_language", as: :show_in_language
end
end
resources :organizations do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment