diff --git a/app/assets/stylesheets/procedure_context.scss b/app/assets/stylesheets/procedure_context.scss index e2f220fd3..109724fab 100644 --- a/app/assets/stylesheets/procedure_context.scss +++ b/app/assets/stylesheets/procedure_context.scss @@ -5,8 +5,6 @@ $procedure-context-breakpoint: $two-columns-breakpoint; $procedure-description-line-height: 22px; .procedure-preview { - font-size: 24px; - .paperless-logo { width: 100%; margin-bottom: 60px; @@ -74,17 +72,6 @@ $procedure-description-line-height: 22px; border-bottom: 1px dotted $blue-france-500; } - .procedure-description { - font-size: 16px; - - p:not(:last-of-type) { - // Space the paragraphs by exactly one line height, - // so that the text always is truncated in the middle of a line, - // regarless of the number of paragraphs. - margin-bottom: 3 * $default-spacer; - } - } - .read-more-button { display: none; } diff --git a/app/components/editable_champ/champ_label_component.rb b/app/components/editable_champ/champ_label_component.rb index 3f8f8abf9..de0a6fea3 100644 --- a/app/components/editable_champ/champ_label_component.rb +++ b/app/components/editable_champ/champ_label_component.rb @@ -1,6 +1,4 @@ class EditableChamp::ChampLabelComponent < ApplicationComponent - include StringToHtmlHelper - def initialize(form:, champ:, seen_at: nil) @form, @champ, @seen_at = form, champ, seen_at end diff --git a/app/components/editable_champ/editable_champ_component.rb b/app/components/editable_champ/editable_champ_component.rb index e74be2967..2b9391104 100644 --- a/app/components/editable_champ/editable_champ_component.rb +++ b/app/components/editable_champ/editable_champ_component.rb @@ -1,6 +1,4 @@ class EditableChamp::EditableChampComponent < ApplicationComponent - include StringToHtmlHelper - def initialize(form:, champ:, seen_at: nil) @form, @champ, @seen_at = form, champ, seen_at end diff --git a/app/components/editable_champ/explication_component.rb b/app/components/editable_champ/explication_component.rb index f3173419d..8958b0985 100644 --- a/app/components/editable_champ/explication_component.rb +++ b/app/components/editable_champ/explication_component.rb @@ -1,3 +1,2 @@ class EditableChamp::ExplicationComponent < EditableChamp::EditableChampBaseComponent - include StringToHtmlHelper end diff --git a/app/components/editable_champ/linked_drop_down_list_component.rb b/app/components/editable_champ/linked_drop_down_list_component.rb index e31d49b44..a8d5a89a0 100644 --- a/app/components/editable_champ/linked_drop_down_list_component.rb +++ b/app/components/editable_champ/linked_drop_down_list_component.rb @@ -1,3 +1,2 @@ class EditableChamp::LinkedDropDownListComponent < EditableChamp::EditableChampBaseComponent - include StringToHtmlHelper end diff --git a/app/helpers/string_to_html_helper.rb b/app/helpers/string_to_html_helper.rb deleted file mode 100644 index d41c8300a..000000000 --- a/app/helpers/string_to_html_helper.rb +++ /dev/null @@ -1,15 +0,0 @@ -module StringToHtmlHelper - def string_to_html(str, wrapper_tag = 'p', allow_a: false) - return nil if str.blank? - html_formatted = simple_format(str, {}, { wrapper_tag: wrapper_tag }) - with_links = Anchored::Linker.auto_link(html_formatted, target: '_blank', rel: 'noopener') - - tags = if allow_a - Rails.configuration.action_view.sanitized_allowed_tags + ['a'] - else - Rails.configuration.action_view.sanitized_allowed_tags - end - - sanitize(with_links, tags:, attributes: ['target', 'rel', 'href']) - end -end diff --git a/spec/helpers/string_to_html_helper_spec.rb b/spec/helpers/string_to_html_helper_spec.rb deleted file mode 100644 index 513fdf75c..000000000 --- a/spec/helpers/string_to_html_helper_spec.rb +++ /dev/null @@ -1,49 +0,0 @@ -RSpec.describe StringToHtmlHelper, type: :helper do - describe "#string_to_html" do - let(:allow_a) { false } - subject { string_to_html(description, allow_a:) } - - context "with some simple texte" do - let(:description) { "1er ligne \n 2ieme ligne" } - - it { is_expected.to eq("

1er ligne \n
2ieme ligne

") } - end - - context "with a link" do - context "using an authorized scheme" do - let(:description) { "Cliquez sur https://d-s.fr pour continuer." } - - context 'with a tag authorized' do - let(:allow_a) { true } - it { is_expected.to eq("

Cliquez sur https://d-s.fr pour continuer.

") } - end - - context 'without a tag' do - it { is_expected.to eq("

Cliquez sur https://d-s.fr pour continuer.

") } - end - end - - context "using a non-authorized scheme" do - let(:description) { "Cliquez sur file://etc/password pour continuer." } - it { is_expected.to eq("

Cliquez sur file://etc/password pour continuer.

") } - end - - context "not actually an URL" do - let(:description) { "Pour info: il ne devrait y avoir aucun lien." } - it { is_expected.to eq("

Pour info: il ne devrait y avoir aucun lien.

") } - end - end - - context "with empty decription" do - let(:description) { nil } - - it { is_expected.to eq nil } - end - - context "with a bad script" do - let(:description) { '' } - - it { is_expected.to eq('

bad

') } - end - end -end