Class: Ariadne::Form::BaseComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponentContrib::Base
- BaseComponent
- Ariadne::Form::BaseComponent
- Extended by:
- Ariadne::Forms::ActsAsComponent
- Includes:
- ClassNameHelper, LabelHelper
- Defined in:
- app/components/ariadne/form/base_component.rb
Overview
:nodoc:
Direct Known Subclasses
FormControl::Component, FormReference::Component, Group::Component, Separator::Component, Toggle::Component, ValidationMessage::Component
Constant Summary
Constants included from LabelHelper
LabelHelper::BASE_LABEL_STYLES
Constants inherited from BaseComponent
BaseComponent::ACCEPT_ANYTHING
Constants included from ViewHelper
Constants included from AttributesHelper
AttributesHelper::PLURAL_ARIA_ATTRIBUTES, AttributesHelper::PLURAL_DATA_ATTRIBUTES
Instance Attribute Summary
Attributes included from Ariadne::Forms::ActsAsComponent
Class Method Summary collapse
Instance Method Summary collapse
- #content ⇒ Object
-
#input? ⇒ Boolean
:nocov:.
- #perform_render(&block) ⇒ Object
- #render? ⇒ Boolean
- #to_component ⇒ Object
-
#type ⇒ Object
:nocov:.
Methods included from Ariadne::Forms::ActsAsComponent
compile!, extended, renders_templates
Methods included from LabelHelper
Methods included from ClassNameHelper
Methods inherited from BaseComponent
audited_at, #class_for, #component, component_id, #component_id, component_name, generate_id, #html_attributes, i18n_scope, #merge_data_attributes, #merge_tailwind_classes, #options, stimulus_name, translate, #validate_aria_label!
Methods included from AttributesHelper
#aria, #data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes, #prepend_action, #prepend_controller, #prepend_data_attribute
Methods included from ViewComponent::StyleVariants
Class Method Details
.inherited(base) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/components/ariadne/form/base_component.rb', line 12 def self.inherited(base) base_path = Ariadne::Forms::Utils.const_source_location(base.name) unless base_path warn("Could not identify the template for #{base}") return end dir = File.dirname(base_path) base.renders_template(File.join(dir, "#{base.name.demodulize.underscore}.html.erb"), :render_template) end |
Instance Method Details
#content ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'app/components/ariadne/form/base_component.rb', line 33 def content return @__prf_content if defined?(@__prf_content_evaluated) && @__prf_content_evaluated @__prf_content_evaluated = true @__prf_content = capture do @__prf_content_block.call end end |
#input? ⇒ Boolean
:nocov:
48 49 50 |
# File 'app/components/ariadne/form/base_component.rb', line 48 def input? false end |
#perform_render(&block) ⇒ Object
26 27 28 29 30 31 |
# File 'app/components/ariadne/form/base_component.rb', line 26 def perform_render(&block) return "" unless render? @__prf_content_block = block compile_and_render_template end |
#render? ⇒ Boolean
56 57 58 |
# File 'app/components/ariadne/form/base_component.rb', line 56 def render? true end |
#to_component ⇒ Object
52 53 54 |
# File 'app/components/ariadne/form/base_component.rb', line 52 def to_component self end |
#type ⇒ Object
:nocov:
43 44 45 |
# File 'app/components/ariadne/form/base_component.rb', line 43 def type :component end |