Class: Protos::Collapse

Inherits:
Component
  • Object
show all
Defined in:
lib/protos/collapse.rb,
lib/protos/collapse/title.rb,
lib/protos/collapse/content.rb

Defined Under Namespace

Classes: Content, Title

Instance Method Summary collapse

Methods inherited from Component

#initialize

Constructor Details

This class inherits a constructor from Protos::Component

Instance Method Details

#contentObject



37
# File 'lib/protos/collapse.rb', line 37

def content(...) = render Content.new(...)

#titleObject



35
# File 'lib/protos/collapse.rb', line 35

def title(*, **, &) = render Title.new(*, input_id: @input_name, **, &)

#view_templateObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/protos/collapse.rb', line 18

def view_template
  div(**attrs) do
    if @input_type
      input(
        type: @input_type,
        id: @input_name,
        name: @input_name,
        autocomplete: :off,
        # form: "" prevents the radio button from being submitted if its
        # within a form
        form: ""
      )
    end
    yield if block_given?
  end
end