2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-12-14 16:23:15 +01:00
|
|
|
module ChampHelper
|
2019-09-26 17:40:52 +02:00
|
|
|
def format_text_value(text)
|
|
|
|
sanitized_text = sanitize(text)
|
|
|
|
auto_linked_text = Anchored::Linker.auto_link(sanitized_text, target: '_blank', rel: 'noopener') do |link_href|
|
|
|
|
truncate(link_href, length: 60)
|
|
|
|
end
|
|
|
|
simple_format(auto_linked_text, {}, sanitize: false)
|
|
|
|
end
|
2019-11-20 20:47:36 +01:00
|
|
|
|
2024-11-04 11:41:24 +01:00
|
|
|
def auto_attach_url(object, procedure_id: nil)
|
2022-05-07 17:49:27 +02:00
|
|
|
if object.is_a?(Champ)
|
2024-11-04 11:41:24 +01:00
|
|
|
champs_piece_justificative_url(object.dossier, object.stable_id, row_id: object.row_id)
|
2023-12-19 09:51:49 +01:00
|
|
|
elsif object.is_a?(TypeDeChamp) && object.piece_justificative?
|
2024-11-04 11:41:24 +01:00
|
|
|
piece_justificative_template_admin_procedure_type_de_champ_url(stable_id: object.stable_id, procedure_id:)
|
2023-12-19 09:51:49 +01:00
|
|
|
elsif object.is_a?(TypeDeChamp) && object.explication?
|
2024-11-04 11:41:24 +01:00
|
|
|
notice_explicative_admin_procedure_type_de_champ_url(stable_id: object.stable_id, procedure_id:)
|
2020-03-30 15:34:56 +02:00
|
|
|
end
|
|
|
|
end
|
2017-12-14 16:23:15 +01:00
|
|
|
end
|