Class: Brut::FrontEnd::Component
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- Brut::FrontEnd::Component
- Includes:
- Brut::Framework::Errors, Helpers, I18n::ForHTML
- Defined in:
- lib/brut/front_end/component.rb
Overview
A Component is the top level class for managing the rendering of content. It is a Phlex component with additional features. Components are the primary mechanism for managing view complexity and managing markup re-use in Brut.
To create a component, subclass this class (or, more likely, your app's AppComponent
) and
provide an initializer that accepts keyword arguments. The names of these arguments will be used to locate the
values that Brut will pass in when creating your component object.
Consult Brut's documentation on keyword injection to know what values you may use and how values are located.
Becuase this is a Phlex component, you must implement view_template
and make calls to Phlex's API to create
the markup for your component.
Direct Known Subclasses
Brut::FrontEnd::Components::ConstraintViolations, Brut::FrontEnd::Components::FormTag, Brut::FrontEnd::Components::I18nTranslations, Brut::FrontEnd::Components::Input, Brut::FrontEnd::Components::LocaleDetection, Brut::FrontEnd::Components::PageIdentifier, Brut::FrontEnd::Components::TimeTag, Brut::FrontEnd::Components::Traceparent, Layout, Page
Defined Under Namespace
Modules: Helpers
Class Method Summary collapse
-
.component_name ⇒ Object
The name of this component, used for debugging and other purposes.
Instance Method Summary collapse
-
#component_name ⇒ Object
Convenience method to get the component name.
Methods included from Helpers
#global_component, #inline_svg
Methods included from I18n::ForHTML
Methods included from I18n::BaseMethods
#l, #t, #t_direct, #this_field_value
Methods included from Brut::Framework::Errors
Class Method Details
.component_name ⇒ Object
The name of this component, used for debugging and other purposes. Do not override this.
115 116 117 |
# File 'lib/brut/front_end/component.rb', line 115 def self.component_name = self.name # Convenience method to get the component name. This just calls the class # method {.component_name}. |
Instance Method Details
#component_name ⇒ Object
Convenience method to get the component name. This just calls the class method component_name.
118 |
# File 'lib/brut/front_end/component.rb', line 118 def component_name = self.class.component_name |