Fix "see more" link for prefillable fields

This commit is contained in:
Damien Le Thiec 2023-01-31 16:48:38 +01:00
parent d7b01255fe
commit e1748a2666
3 changed files with 4 additions and 2 deletions

View file

@ -142,7 +142,7 @@ module ApplicationHelper
end
def new_tab_suffix(title)
"#{title}#{t('utils.new_tab')}"
"#{title}#{I18n.t('utils.new_tab')}"
end
def download_details(attachment)

View file

@ -129,6 +129,7 @@ class TypeDeChamp < ApplicationRecord
delegate :estimated_fill_duration, :estimated_read_duration, :tags_for_template, :libelle_for_export, to: :dynamic_type
delegate :active_revision, to: :procedure, prefix: true
delegate :path, to: :procedure
class WithIndifferentAccess
def self.load(options)

View file

@ -1,10 +1,11 @@
class TypesDeChamp::PrefillRepetitionTypeDeChamp < TypesDeChamp::PrefillTypeDeChamp
include ActionView::Helpers::UrlHelper
include ApplicationHelper
def possible_values
prefillable_subchamps.map do |prefill_type_de_champ|
if prefill_type_de_champ.too_many_possible_values?
link = link_to "Voir toutes les valeurs possibles", Rails.application.routes.url_helpers.prefill_type_de_champ_path("piece-jointe", prefill_type_de_champ)
link = link_to I18n.t("views.prefill_descriptions.edit.possible_values.link.text"), Rails.application.routes.url_helpers.prefill_type_de_champ_path(prefill_type_de_champ.path, prefill_type_de_champ), title: ActionController::Base.helpers.sanitize(new_tab_suffix(I18n.t("views.prefill_descriptions.edit.possible_values.link.title"))), **external_link_attributes
"#{prefill_type_de_champ.libelle}: #{link}"
else
"#{prefill_type_de_champ.libelle}: #{prefill_type_de_champ.possible_values_sentence}"