From eb71207457bcf1111bc22789f8c53020cc8bab26 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 14 Sep 2022 16:28:00 +0200 Subject: [PATCH] fix(conditional): change number input to text input, to display original text not empty in the error message --- app/assets/stylesheets/conditions_component.scss | 4 ++-- app/components/types_de_champ_editor/conditions_component.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/assets/stylesheets/conditions_component.scss b/app/assets/stylesheets/conditions_component.scss index 4633531bd..585819cbc 100644 --- a/app/assets/stylesheets/conditions_component.scss +++ b/app/assets/stylesheets/conditions_component.scss @@ -1,7 +1,7 @@ @import "colors"; @import "constants"; -.conditionnel { +form.form > .conditionnel { .condition-error { background: $background-red; @@ -64,7 +64,7 @@ margin-bottom: 0; } - input[type=number] { + input[type=text] { display: inline-block; margin-bottom: 0; } diff --git a/app/components/types_de_champ_editor/conditions_component.rb b/app/components/types_de_champ_editor/conditions_component.rb index 1d1cfd74a..8b792de2b 100644 --- a/app/components/types_de_champ_editor/conditions_component.rb +++ b/app/components/types_de_champ_editor/conditions_component.rb @@ -169,7 +169,7 @@ class TypesDeChampEditor::ConditionsComponent < ApplicationComponent class: { alert: right_invalid } ) when :number - number_field_tag( + text_field_tag( input_name_for('value'), right.value, required: true, @@ -177,7 +177,7 @@ class TypesDeChampEditor::ConditionsComponent < ApplicationComponent class: { alert: right_invalid } ) else - number_field_tag(input_name_for('value'), '', id: input_id_for('value', row_index)) + text_field_tag(input_name_for('value'), '', id: input_id_for('value', row_index)) end end