Class: GovukComponent::SummaryListComponent::RowComponent

Inherits:
Base
  • Object
show all
Defined in:
app/components/govuk_component/summary_list_component/row_component.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#html_attributes

Instance Method Summary collapse

Constructor Details

#initialize(show_actions_column: nil, classes: [], html_attributes: {}) ⇒ RowComponent

Returns a new instance of RowComponent.



8
9
10
11
12
# File 'app/components/govuk_component/summary_list_component/row_component.rb', line 8

def initialize(show_actions_column: nil, classes: [], html_attributes: {})
  @show_actions_column = show_actions_column

  super(classes: classes, html_attributes: html_attributes)
end

Instance Attribute Details

#hrefObject (readonly)

Returns the value of attribute href.



2
3
4
# File 'app/components/govuk_component/summary_list_component/row_component.rb', line 2

def href
  @href
end

#show_actions_columnObject (readonly)

Returns the value of attribute show_actions_column.



2
3
4
# File 'app/components/govuk_component/summary_list_component/row_component.rb', line 2

def show_actions_column
  @show_actions_column
end

#visually_hidden_textObject (readonly)

Returns the value of attribute visually_hidden_text.



2
3
4
# File 'app/components/govuk_component/summary_list_component/row_component.rb', line 2

def visually_hidden_text
  @visually_hidden_text
end

Instance Method Details

#before_renderObject



20
21
22
23
24
# File 'app/components/govuk_component/summary_list_component/row_component.rb', line 20

def before_render
  if show_actions_column && actions.none?
    html_attributes[:class] << no_actions_class
  end
end

#callObject



14
15
16
17
18
# File 'app/components/govuk_component/summary_list_component/row_component.rb', line 14

def call
  tag.div(**html_attributes) do
    safe_join([key, value, actions_content])
  end
end