diff --git a/app/controllers/admin/communication/extranets/alumni_controller.rb b/app/controllers/admin/communication/extranets/alumni_controller.rb index cc4f5fbc7e3bceb210998b6b7b516ac5fad56b6a..fc15ee3132c1a95bb2621a8cfcb685bbc930ccbf 100644 --- a/app/controllers/admin/communication/extranets/alumni_controller.rb +++ b/app/controllers/admin/communication/extranets/alumni_controller.rb @@ -4,7 +4,7 @@ class Admin::Communication::Extranets::AlumniController < Admin::Communication:: @alumni = @extranet.alumni @cohorts = @extranet.cohorts @years = @extranet.years - @organizations = @extranet.organizations + @organizations = @extranet.organizations.for_language_id(current_university.default_language_id) breadcrumb add_breadcrumb Communication::Extranet.human_attribute_name(:feature_alumni) end diff --git a/app/controllers/admin/communication/extranets/contacts_controller.rb b/app/controllers/admin/communication/extranets/contacts_controller.rb index 7a88f34f4bf16457a644bbd3094c79574c096291..52fe1c4f5b4c7d579c6bd3a63615839d08e69750 100644 --- a/app/controllers/admin/communication/extranets/contacts_controller.rb +++ b/app/controllers/admin/communication/extranets/contacts_controller.rb @@ -2,8 +2,14 @@ class Admin::Communication::Extranets::ContactsController < Admin::Communication def index respond_to do |format| format.html { - @people = current_university.people.ordered.page params[:persons_page] - @organizations = current_university.organizations.ordered.page params[:organizations_page] + @people = current_university.people + .for_language_id(current_university.default_language_id) + .ordered + .page(params[:persons_page]) + @organizations = current_university.organizations + .for_language_id(current_university.default_language_id) + .ordered + .page(params[:organizations_page]) } format.xlsx { # params[export] can be "people" oe "organizations" diff --git a/app/controllers/admin/university/organizations_controller.rb b/app/controllers/admin/university/organizations_controller.rb index 6167f0f85b5cab3b2f9a2c4972380dfc826db9ce..1cc8770bd352bc4f766102f6c31ab7124a39831e 100644 --- a/app/controllers/admin/university/organizations_controller.rb +++ b/app/controllers/admin/university/organizations_controller.rb @@ -28,6 +28,7 @@ class Admin::University::OrganizationsController < Admin::University::Applicatio def search @term = params[:term].to_s @organizations = current_university.organizations + .for_language_id(current_university.default_language_id) .search_by_siren_or_name(@term) .ordered end diff --git a/app/controllers/extranet/organizations_controller.rb b/app/controllers/extranet/organizations_controller.rb index af318f25a12e5deabde835ae1e8818b5be56f243..4b0333de2f14997876cacf00aaa1d4ae4af0684f 100644 --- a/app/controllers/extranet/organizations_controller.rb +++ b/app/controllers/extranet/organizations_controller.rb @@ -4,8 +4,9 @@ class Extranet::OrganizationsController < Extranet::ApplicationController def search @term = params[:term].to_s @organizations = current_university.organizations - .search_by_siren_or_name(@term) - .ordered + .for_language_id(current_university.default_language_id) + .search_by_siren_or_name(@term) + .ordered end def show diff --git a/app/models/communication/block/component/organization.rb b/app/models/communication/block/component/organization.rb index 1e095f8772e9780bdc62c9a15d4e6e11369e0fe1..1acd7bd0d9ccbfcb3a297ea22ea179d9ec22003e 100644 --- a/app/models/communication/block/component/organization.rb +++ b/app/models/communication/block/component/organization.rb @@ -1,7 +1,10 @@ class Communication::Block::Component::Organization < Communication::Block::Component::Base def organization - template.block.university.organizations.find_by(id: data) + template.block + .university + .organizations + .find_by(id: data) end def dependencies @@ -9,7 +12,8 @@ class Communication::Block::Component::Organization < Communication::Block::Comp end def translate! - # TODO: Traduction des Organisations à faire + return unless data.present? + @data = organization.find_or_translate!(template.language).id end end diff --git a/app/models/communication/block/component/person.rb b/app/models/communication/block/component/person.rb index a03a1538b4d8712ee68d0b73935403030c1772e6..334010b21acfa601c49b0b3471cc60d5b248534e 100644 --- a/app/models/communication/block/component/person.rb +++ b/app/models/communication/block/component/person.rb @@ -1,7 +1,10 @@ class Communication::Block::Component::Person < Communication::Block::Component::Base def person - template.block.university.people.find_by(id: data) + template.block + .university + .people + .find_by(id: data) end def dependencies diff --git a/app/services/filters/admin/university/alumni.rb b/app/services/filters/admin/university/alumni.rb index fec367846af24ff838282d58eb38449375bee766..17f2ed3fe355717d2bc719d8d53db89a36cfd198 100644 --- a/app/services/filters/admin/university/alumni.rb +++ b/app/services/filters/admin/university/alumni.rb @@ -3,7 +3,7 @@ module Filters def initialize(user) super add :for_alumni_organization, - user.university.organizations.ordered, + user.university.organizations.for_language_id(current_university.default_language_id).ordered, I18n.t( 'filters.attributes.element', element: University::Organization.model_name.human.downcase diff --git a/app/services/importers/hash_to_experience.rb b/app/services/importers/hash_to_experience.rb index 8f6e88ffb21358bf44118b21b202df29b990deea..6c3604a921f2e2aeb6ee5fe88df21ba6a65d0a79 100644 --- a/app/services/importers/hash_to_experience.rb +++ b/app/services/importers/hash_to_experience.rb @@ -51,19 +51,23 @@ module Importers # Search by SIREN+NIC, then SIREN, then name, or create it with everything if @company_siren.present? && @company_nic.present? obj = @university.organizations - .find_by siren: @company_siren, - nic: @company_nic + .for_language_id(current_university.default_language_id) + .find_by siren: @company_siren, + nic: @company_nic elsif @company_siren.present? obj = @university.organizations - .find_by siren: @company_siren + .for_language_id(current_university.default_language_id) + .find_by siren: @company_siren end obj ||= @university.organizations - .find_by name: @company_name + .for_language_id(current_university.default_language_id) + .find_by name: @company_name obj ||= @university.organizations - .where( name: @company_name, - siren: @company_siren, - nic: @company_nic) - .first_or_create + .for_language_id(current_university.default_language_id) + .where( name: @company_name, + siren: @company_siren, + nic: @company_nic) + .first_or_create obj end end diff --git a/app/views/admin/communication/blocks/components/organization/_edit.html.erb b/app/views/admin/communication/blocks/components/organization/_edit.html.erb index 48fb8775666bb52de24429db995dcbdfaeca9622..4b67c59f040c2c79e0c9afa301c836fbdbef112e 100644 --- a/app/views/admin/communication/blocks/components/organization/_edit.html.erb +++ b/app/views/admin/communication/blocks/components/organization/_edit.html.erb @@ -1,5 +1,6 @@ -<%# TODO: Traduire les organisations %> -<% organizations = current_university.organizations.ordered %> +<% organizations = current_university.organizations + .for_language_id(current_university.default_language_id) + .ordered %> <% unless label.blank? %> <label class="form-label" :for="<%= dom_id.html_safe %>"> diff --git a/app/views/admin/university/people/experiences/_experience_fields.html.erb b/app/views/admin/university/people/experiences/_experience_fields.html.erb index 820d47b06518502b08d69d3a148047b6e9d24450..2b05b2c361f0862379a9991bfc3e864ec01f4adb 100644 --- a/app/views/admin/university/people/experiences/_experience_fields.html.erb +++ b/app/views/admin/university/people/experiences/_experience_fields.html.erb @@ -10,7 +10,9 @@ hint = can?(:create, University::Organization) ? t('university.person.experienc <div class="row flex-fill"> <div class="col-md-6 col-xxl-4"> <%= f.association :organization, - collection: current_university.organizations.ordered, + collection: current_university.organizations + .for_language_id(current_university.default_language_id) + .ordered, include_blank: t('simple_form.include_blanks.defaults.organization'), hint: hint, required: true,