Class: GovukComponent::TableComponent::CellComponent
- Inherits:
-
Base
- Object
- ViewComponent::Base
- Base
- GovukComponent::TableComponent::CellComponent
- Defined in:
- app/components/govuk_component/table_component/cell_component.rb
Instance Attribute Summary collapse
-
#colspan ⇒ Object
readonly
Returns the value of attribute colspan.
-
#header ⇒ Object
(also: #header?)
readonly
Returns the value of attribute header.
-
#numeric ⇒ Object
(also: #numeric?)
readonly
Returns the value of attribute numeric.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#rowspan ⇒ Object
readonly
Returns the value of attribute rowspan.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(scope: nil, header: nil, numeric: false, text: nil, width: nil, parent: nil, rowspan: nil, colspan: nil, classes: [], html_attributes: {}) ⇒ CellComponent
constructor
A new instance of CellComponent.
Methods inherited from Base
Constructor Details
#initialize(scope: nil, header: nil, numeric: false, text: nil, width: nil, parent: nil, rowspan: nil, colspan: nil, classes: [], html_attributes: {}) ⇒ CellComponent
Returns a new instance of CellComponent.
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/components/govuk_component/table_component/cell_component.rb', line 18 def initialize(scope: nil, header: nil, numeric: false, text: nil, width: nil, parent: nil, rowspan: nil, colspan: nil, classes: [], html_attributes: {}) @text = text @numeric = numeric @width = width @scope = scope @parent = parent @colspan = colspan @rowspan = rowspan @header = (header.nil?) ? in_thead? : header super(classes:, html_attributes:) end |
Instance Attribute Details
#colspan ⇒ Object (readonly)
Returns the value of attribute colspan.
2 3 4 |
# File 'app/components/govuk_component/table_component/cell_component.rb', line 2 def colspan @colspan end |
#header ⇒ Object (readonly) Also known as: header?
Returns the value of attribute header.
2 3 4 |
# File 'app/components/govuk_component/table_component/cell_component.rb', line 2 def header @header end |
#numeric ⇒ Object (readonly) Also known as: numeric?
Returns the value of attribute numeric.
2 3 4 |
# File 'app/components/govuk_component/table_component/cell_component.rb', line 2 def numeric @numeric end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
2 3 4 |
# File 'app/components/govuk_component/table_component/cell_component.rb', line 2 def parent @parent end |
#rowspan ⇒ Object (readonly)
Returns the value of attribute rowspan.
2 3 4 |
# File 'app/components/govuk_component/table_component/cell_component.rb', line 2 def rowspan @rowspan end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
2 3 4 |
# File 'app/components/govuk_component/table_component/cell_component.rb', line 2 def scope @scope end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
2 3 4 |
# File 'app/components/govuk_component/table_component/cell_component.rb', line 2 def text @text end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
2 3 4 |
# File 'app/components/govuk_component/table_component/cell_component.rb', line 2 def width @width end |
Class Method Details
.widths ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'app/components/govuk_component/table_component/cell_component.rb', line 7 def self.widths { "full" => "#{brand}-!-width-full", "three-quarters" => "#{brand}-!-width-three-quarters", "two-thirds" => "#{brand}-!-width-two-thirds", "one-half" => "#{brand}-!-width-one-half", "one-third" => "#{brand}-!-width-one-third", "one-quarter" => "#{brand}-!-width-one-quarter", }.freeze end |
Instance Method Details
#call ⇒ Object
31 32 33 |
# File 'app/components/govuk_component/table_component/cell_component.rb', line 31 def call content_tag(cell_element, cell_content, **html_attributes) end |