sdr_view_components 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/components/sdr_view_components/forms/basic_file_component.rb +4 -0
- data/app/components/sdr_view_components/forms/checkbox_component.rb +1 -0
- data/app/components/sdr_view_components/forms/field_component.html.erb +2 -1
- data/app/components/sdr_view_components/forms/field_component.rb +11 -2
- data/lib/sdr_view_components/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1afffad2e6ed29d15558f17747dede5386da6e4535767947fb6b1970985f436e
|
|
4
|
+
data.tar.gz: 60a9a0124d9d480c4194933f1548d1e2dd2b499d67ef6254199afc3e8e734abe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ef3eb4a9b57b8664d1d4991c7707094e2bbe21760fee98bb400a752e6400663460214b8a8d085b9848ca5eae9f1c753bce68f093f637fecb369657829309920d
|
|
7
|
+
data.tar.gz: '0229b05c83c16f0d3404efe05369dd8b6b2de73286c8b0b9c8c0568febfb82abc853e8dc812ae738f68fd808016281cad65ff0606c7376ab1a72b15c8a5f57d8'
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<%= tag.div class: container_classes, **container_args do %>
|
|
2
2
|
<%= render SdrViewComponents::Forms::LabelComponent.new(form:, field_name: label_field_name, **label_args) %>
|
|
3
|
-
<%= render SdrViewComponents::Forms::HelpTextComponent.new(**help_text_args) %>
|
|
3
|
+
<%= render SdrViewComponents::Forms::HelpTextComponent.new(**help_text_args) unless help_text_below? %>
|
|
4
4
|
<%= render input_component %>
|
|
5
5
|
<%= render SdrViewComponents::Forms::InvalidFeedbackComponent.new(form:, field_name:, **error_args) %>
|
|
6
|
+
<%= render SdrViewComponents::Forms::HelpTextComponent.new(**help_text_args) if help_text_below? %>
|
|
6
7
|
|
|
7
8
|
<%= additional_container_content %>
|
|
8
9
|
<% end %>
|
|
@@ -6,15 +6,20 @@ module SdrViewComponents
|
|
|
6
6
|
class FieldComponent < BaseComponent
|
|
7
7
|
renders_one :additional_container_content
|
|
8
8
|
|
|
9
|
-
def initialize(form:, field_name:, container_classes: [], **args)
|
|
9
|
+
def initialize(form:, field_name:, container_classes: [], variant: :default, **args)
|
|
10
10
|
@form = form
|
|
11
11
|
@field_name = field_name
|
|
12
12
|
@container_classes = container_classes
|
|
13
|
+
@variant = variant
|
|
14
|
+
# In the help_text_below variant, the help text is rendered below the input field.
|
|
15
|
+
# This is necessary for some types of fields such as checkboxes.
|
|
16
|
+
raise ArgumentError, 'invalid variant' unless %i[default help_text_below].include?(@variant)
|
|
17
|
+
|
|
13
18
|
@args = args
|
|
14
19
|
super()
|
|
15
20
|
end
|
|
16
21
|
|
|
17
|
-
attr_reader :form, :args, :field_name
|
|
22
|
+
attr_reader :form, :args, :field_name, :variant
|
|
18
23
|
|
|
19
24
|
# Any component that inherits from FieldComponent must implement this method
|
|
20
25
|
# or provide its own template.
|
|
@@ -71,6 +76,10 @@ module SdrViewComponents
|
|
|
71
76
|
def container_classes
|
|
72
77
|
merge_classes(@container_classes)
|
|
73
78
|
end
|
|
79
|
+
|
|
80
|
+
def help_text_below?
|
|
81
|
+
variant == :help_text_below
|
|
82
|
+
end
|
|
74
83
|
##########################################################################
|
|
75
84
|
|
|
76
85
|
private
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sdr_view_components
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Aaron Collier
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 2026-01-06 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: rails
|