From f9812248408c55a9aa814f15c11c45a2638e97fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20D=C4=85browski?= Date: Wed, 4 Sep 2024 11:50:43 +0200 Subject: [PATCH 1/2] Use textarea instead of text input type in view mode to not scroll the value --- app/helpers/rails_i18n_manager/custom_form_builder.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/rails_i18n_manager/custom_form_builder.rb b/app/helpers/rails_i18n_manager/custom_form_builder.rb index bf7dc0a..49df9bf 100644 --- a/app/helpers/rails_i18n_manager/custom_form_builder.rb +++ b/app/helpers/rails_i18n_manager/custom_form_builder.rb @@ -79,7 +79,7 @@ def _view_field(method, type, options) options[:input_html][:class] ||= "" options[:input_html][:class].concat(" form-control-plaintext").strip! options[:input_html][:readonly] = true - options[:input_html][:type] = "text" + options[:input_html][:type] = "textarea" options[:input_html].delete(:name) if !options[:input_html].has_key?(:value) From 764b182df81b5570469ca29f2dbdadc523d3a9be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20D=C4=85browski?= Date: Wed, 4 Sep 2024 12:02:07 +0200 Subject: [PATCH 2/2] Render text area instead of text input for view mode --- app/helpers/rails_i18n_manager/custom_form_builder.rb | 2 +- app/views/rails_i18n_manager/form_builder/_basic_field.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/rails_i18n_manager/custom_form_builder.rb b/app/helpers/rails_i18n_manager/custom_form_builder.rb index 49df9bf..bf7dc0a 100644 --- a/app/helpers/rails_i18n_manager/custom_form_builder.rb +++ b/app/helpers/rails_i18n_manager/custom_form_builder.rb @@ -79,7 +79,7 @@ def _view_field(method, type, options) options[:input_html][:class] ||= "" options[:input_html][:class].concat(" form-control-plaintext").strip! options[:input_html][:readonly] = true - options[:input_html][:type] = "textarea" + options[:input_html][:type] = "text" options[:input_html].delete(:name) if !options[:input_html].has_key?(:value) diff --git a/app/views/rails_i18n_manager/form_builder/_basic_field.html.erb b/app/views/rails_i18n_manager/form_builder/_basic_field.html.erb index fd78a25..04e513a 100644 --- a/app/views/rails_i18n_manager/form_builder/_basic_field.html.erb +++ b/app/views/rails_i18n_manager/form_builder/_basic_field.html.erb @@ -49,7 +49,7 @@ <% field = capture do %> <% if type == :view %> - <%= text_field_tag nil, options[:input_html][:value], options[:input_html] %> + <%= text_area_tag nil, options[:input_html][:value], options[:input_html] %> <% elsif type == :select %> <%= f.select(