Class: BulmaX::Field
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- BulmaX::Field
- Defined in:
- lib/bulma_x/field.rb
Defined Under Namespace
Classes: Control, FieldLabel, Label
Constant Summary
Constants inherited from BaseComponent
BaseComponent::BLANK_VALUES, BaseComponent::BOOLEAN, BaseComponent::COLORS, BaseComponent::COLOR_MODIFIER, BaseComponent::COLOR_PALETTE, BaseComponent::MODIFIERS, BaseComponent::MODIFIERS_DECLINED, BaseComponent::MODIFIERS_PALETTE
Constants included from Shared::SpacingOptions
Shared::SpacingOptions::VALID_SPACING_KEYS, Shared::SpacingOptions::VALID_SPACING_VALUES
Instance Method Summary collapse
-
#render_self ⇒ Object
rubocop:disable Metrics/PerceivedComplexity, Metrics/AbcSize, Metrics/CyclomaticComplexity.
-
#root_classes ⇒ Object
rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity.
- #view_template ⇒ Object
Methods inherited from BaseComponent
#after_template, #attributes, #base_attributes, #base_classes, #before_template, #classes, #compact_blank, #css, #initialize, #render_root
Methods included from Shared::AriaOptions
Methods included from Shared::GlobalOptions
#global_attributes, #global_classes, included
Methods included from Shared::DataOptions
Methods included from Shared::FlexOptions
Methods included from Shared::SpacingOptions
Methods included from Shared::TextOptions
Methods included from ComponentDsl
Constructor Details
This class inherits a constructor from BulmaX::BaseComponent
Instance Method Details
#render_self ⇒ Object
rubocop:disable Metrics/PerceivedComplexity, Metrics/AbcSize, Metrics/CyclomaticComplexity
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/bulma_x/field.rb', line 38 def render_self render_root do slot(:field_label) if slot?(:field_label) if @horizontal || slot?(:field) slot(:field_body) do slots(:field).each { render it } end else unless slot?(:field_label) slot(:label) if slot?(:label) slots(:control).each { render it } end end slot(:help) if slot?(:help) end end |
#root_classes ⇒ Object
rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/bulma_x/field.rb', line 60 def root_classes super + [ 'field', @has_addons && 'has-addons', @has_addons && @addons_alignment && "has-addons-#{@addons_alignment}", @grouped && 'is-grouped', @grouped && @group_alignment && "is-grouped-#{@group_alignment}", @grouped && @group_multiline && 'is-grouped-multiline', && 'is-expanded', @narrow && 'is-narrow', @horizontal && 'is-horizontal' ] end |
#view_template ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/bulma_x/field.rb', line 29 def view_template(&) if @disabled fieldset(disabled: true) { render_self(&) } else render_self(&) end end |