Auto-link valeur des champs

closes #2865
This commit is contained in:
Paul Chavard 2019-09-26 17:40:52 +02:00
parent d92cf6617a
commit e7ed408e08
6 changed files with 25 additions and 2 deletions

View file

@ -17,4 +17,12 @@ module ChampHelper
{ type_de_champ_id: champ.type_de_champ_id }
end
end
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
end