Class: Primer::Forms::Group
- Inherits:
-
BaseComponent
- Object
- BaseComponent
- Primer::Forms::Group
- Defined in:
- app/lib/primer/forms/group.rb
Overview
:nodoc:
Constant Summary collapse
- VERTICAL =
:vertical
- HORIZONTAL =
:horizontal
- DEFAULT_LAYOUT =
VERTICAL
- LAYOUTS =
[VERTICAL, HORIZONTAL].freeze
Instance Method Summary collapse
- #horizontal? ⇒ Boolean
-
#initialize(inputs:, builder:, form:, layout: DEFAULT_LAYOUT, **system_arguments) ⇒ Group
constructor
A new instance of Group.
Methods inherited from BaseComponent
compile!, #content, #input?, #perform_render, #render?, #to_component, #type
Methods included from ActsAsComponent
#compile!, extended, #renders_templates
Methods included from ClassNameHelper
Constructor Details
#initialize(inputs:, builder:, form:, layout: DEFAULT_LAYOUT, **system_arguments) ⇒ Group
Returns a new instance of Group.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/lib/primer/forms/group.rb', line 14 def initialize(inputs:, builder:, form:, layout: DEFAULT_LAYOUT, **system_arguments) @inputs = inputs @builder = builder @form = form @layout = layout @system_arguments = system_arguments @system_arguments[:display] = :none if inputs.all?(&:hidden?) @system_arguments[:classes] = class_names( @system_arguments.delete(:classes), "FormControl-horizontalGroup" => horizontal?, "FormControl-spacingWrapper" => !horizontal? && inputs.size > 1 ) end |
Instance Method Details
#horizontal? ⇒ Boolean
30 31 32 |
# File 'app/lib/primer/forms/group.rb', line 30 def horizontal? @layout == HORIZONTAL end |