diff --git a/README.md b/README.md index a6a65b2..6c7a4e4 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,6 @@ What does a form control or an input group consist of? * [ ] Support all Rails form builder tags * [ ] ARIA! * [ ] Create a standard set of styles that can be distributed with the gem, so it looks proper - perhaps based on Flowbite? -* [ ] Should I18n scope be "felt", not "form"? ## Glossary and terms diff --git a/lib/help.rb b/lib/help.rb index 9b28e21..ecffbf7 100644 --- a/lib/help.rb +++ b/lib/help.rb @@ -16,7 +16,7 @@ def classes # - classes: Classes to add to the help element. # # - text: The help text to show. If not provided, the text will be looked up - # in the `forms..` translation. See #help for more + # in the `felt..` translation. See #help for more # details. To not render the hint, pass +false+ (or any object that # responds +true+ to +blank?+). # @@ -41,7 +41,7 @@ def render? # # 1. The text argument passed to the component. Pass +false+ to not render # the help element. - # 2. The `help` key in the `forms..` translation. + # 2. The `help` key in the `felt..` translation. # 3. The translation value found under # `helpers.help..` (like with # ActionView::Helpers::FormBuilder#help). @@ -63,7 +63,7 @@ def translate(key) end def translation_scope - [:forms, form.object_name, attribute].join(".") + [:felt, form.object_name, attribute].join(".") end end end diff --git a/lib/hint.rb b/lib/hint.rb index 61b6624..bc97c29 100644 --- a/lib/hint.rb +++ b/lib/hint.rb @@ -16,7 +16,7 @@ def classes # - classes: Classes to add to the hint element. # # - text: The hint text to show. If not provided, the text will be looked up - # in the `forms..` translation. See #hint for more + # in the `felt..` translation. See #hint for more # details. To not render the hint, pass +false+ (or any object that # responds +true+ to +blank?+). # @@ -43,7 +43,7 @@ def render? # # 1. The text argument passed to the component. Pass +false+ to not render # the hint element. - # 2. The `hint` key in the `forms..` translation. + # 2. The `hint` key in the `felt..` translation. # 3. The translation value found under # `helpers.hint..` (like with # ActionView::Helpers::FormBuilder#hint). @@ -65,7 +65,7 @@ def translate(key) end def translation_scope - [:forms, form.object_name, attribute].join(".") + [:felt, form.object_name, attribute].join(".") end end end diff --git a/lib/input_group/base.rb b/lib/input_group/base.rb index 0f5143f..7a80e79 100644 --- a/lib/input_group/base.rb +++ b/lib/input_group/base.rb @@ -47,7 +47,7 @@ def error_classes # Help text is looked up in the following order: # # 1. The help argument passed to the component. - # 2. The `help` key in the `forms..` translation. + # 2. The `help` key in the `felt..` translation. def help return false if @help == false @@ -72,7 +72,7 @@ def help_classes # Hints are looked up in the following order: # # 1. The hint argument passed to the component. - # 2. The `hint` key in the `forms..` translation. + # 2. The `hint` key in the `felt..` translation. def hint return false if @hint == false @@ -94,22 +94,22 @@ def hint_classes # - classes: CSS classes to add to the wrapping input group element. # # - help: The help for the input group. If not provided, the help will be - # looked up in the `forms..` translation. See + # looked up in the `felt..` translation. See # #help for more details. To not render a help text, pass +false+. # # - hint: The hint for the input group. If not provided, the hint will be - # looked up in the `forms..` translation. See + # looked up in the `felt..` translation. See # #hint for more details. To not render a hint, pass +false+. # # - input_options: The options to pass directly to the input field. # # - label: The label text for the input group. If not provided, the text - # will be looked up in the `forms..` + # will be looked up in the `felt..` # translation. See #label for more details. To not render the label, # pass +false+. # # - placeholder: The placeholder for the input field. If not provided, the - # placeholder will be looked up in the `forms..` + # placeholder will be looked up in the `felt..` # translation. See #placeholder for more details. To disable the # placeholder, pass an empty string. # @@ -147,7 +147,7 @@ def label_classes # used: # # 1. The label argument passed to the component. - # 2. The `label` key in the `forms..` translation. + # 2. The `label` key in the `felt..` translation. # 3. The translation value found under # `helpers.label..` (like with # ActionView::Helpers::FormBuilder#label). @@ -171,7 +171,7 @@ def label? # Placeholders are looked up in the following order: # # 1. The placeholder argument passed to the component. - # 2. The `placeholder` key in the `forms..` + # 2. The `placeholder` key in the `felt..` # translation. def placeholder @placeholder ||= @@ -208,7 +208,7 @@ def translate(key) end def translation_scope - [:forms, form.object_name, attribute].join(".") + [:felt, form.object_name, attribute].join(".") end end end diff --git a/lib/label.rb b/lib/label.rb index 153c59e..b9c43db 100644 --- a/lib/label.rb +++ b/lib/label.rb @@ -16,7 +16,7 @@ def classes # - classes: Classes to add to the label element. # # - text: The label text to show. If not provided, the text will be - # looked up in the `forms..` translation. See + # looked up in the `felt..` translation. See # #label for more details. To not render the label, pass false. # # All remaining keyword arguments are passed to the label element. See @@ -40,7 +40,7 @@ def render? # # 1. The text argument passed to the component. Pass +false+ to not render # the label. - # 2. The `label` key in the `forms..` translation. + # 2. The `label` key in the `felt..` translation. # 3. The translation value found under # `helpers.label..` (like with # ActionView::Helpers::FormBuilder#label). @@ -60,7 +60,7 @@ def translate(key) end def translation_scope - [:forms, form.object_name, attribute].join(".") + [:felt, form.object_name, attribute].join(".") end end end diff --git a/test/input_group/common_behavior.rb b/test/input_group/common_behavior.rb index 66d8789..a37aae0 100644 --- a/test/input_group/common_behavior.rb +++ b/test/input_group/common_behavior.rb @@ -151,7 +151,7 @@ def test_renders_help_from_arguments @options = {help: "This has priority over translations"} with_translations({ - forms: { + felt: { "#{@form.object_name}": { "#{@attribute}": { help: "Help from translations" @@ -167,7 +167,7 @@ def test_renders_help_from_arguments def test_renders_help_from_translations with_translations({ - forms: { + felt: { "#{@form.object_name}": { "#{@attribute}": { help: "Help from translations" @@ -184,7 +184,7 @@ def test_renders_help_from_translations def test_does_not_renders_help_from_translations @options = {help: false} with_translations({ - forms: { + felt: { "#{@form.object_name}": { "#{@attribute}": { help: "Help from translations" @@ -241,7 +241,7 @@ def test_renders_hint_from_arguments @options = {hint: "This has priority over translations"} with_translations({ - forms: { + felt: { "#{@form.object_name}": { "#{@attribute}": { hint: "Hint from translations" @@ -257,7 +257,7 @@ def test_renders_hint_from_arguments def test_renders_hint_from_translations with_translations({ - forms: { + felt: { "#{@form.object_name}": { "#{@attribute}": { hint: "Hint from translations" @@ -275,7 +275,7 @@ def test_does_not_render_a_hint_from_translations @options = {hint: false} with_translations({ - forms: { + felt: { "#{@form.object_name}": { "#{@attribute}": { hint: "Hint from translations" diff --git a/test/test_help.rb b/test/test_help.rb index 86eacb9..1784df6 100644 --- a/test/test_help.rb +++ b/test/test_help.rb @@ -48,7 +48,7 @@ class Felt::HelpTest < ViewComponent::TestCase test "renders help text from translations" do with_translations({ - forms: { + felt: { "#{@form.object_name}": { "#{@attribute}": { help: "Help from translations" diff --git a/test/test_hint.rb b/test/test_hint.rb index 29b40cf..774e40d 100644 --- a/test/test_hint.rb +++ b/test/test_hint.rb @@ -48,7 +48,7 @@ class Felt::HintTest < ViewComponent::TestCase test "renders hint text from translations" do with_translations({ - forms: { + felt: { "#{@form.object_name}": { "#{@attribute}": { hint: "Hint from translations"