Class: GovukComponent::TaskListComponent::ItemComponent
- Inherits:
-
Base
- Object
- ViewComponent::Base
- Base
- GovukComponent::TaskListComponent::ItemComponent
- Defined in:
- app/components/govuk_component/task_list_component/item_component.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
writeonly
Sets the attribute count.
-
#hint ⇒ Object
readonly
Returns the value of attribute hint.
-
#href ⇒ Object
readonly
Returns the value of attribute href.
-
#raw_status ⇒ Object
readonly
Returns the value of attribute raw_status.
-
#raw_title ⇒ Object
readonly
Returns the value of attribute raw_title.
Attributes inherited from Base
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(title: nil, href: nil, hint: nil, count: nil, id_prefix: nil, status: {}, classes: [], html_attributes: {}) ⇒ ItemComponent
constructor
A new instance of ItemComponent.
Methods inherited from Base
Constructor Details
#initialize(title: nil, href: nil, hint: nil, count: nil, id_prefix: nil, status: {}, classes: [], html_attributes: {}) ⇒ ItemComponent
Returns a new instance of ItemComponent.
30 31 32 33 34 35 36 37 38 39 |
# File 'app/components/govuk_component/task_list_component/item_component.rb', line 30 def initialize(title: nil, href: nil, hint: nil, count: nil, id_prefix: nil, status: {}, classes: [], html_attributes: {}) @raw_title = title @href = href @hint = hint @raw_status = status @id_prefix = id_prefix @count = count super(classes: classes, html_attributes: html_attributes) end |
Instance Attribute Details
#count=(value) ⇒ Object (writeonly)
Sets the attribute count
28 29 30 |
# File 'app/components/govuk_component/task_list_component/item_component.rb', line 28 def count=(value) @count = value end |
#hint ⇒ Object (readonly)
Returns the value of attribute hint.
27 28 29 |
# File 'app/components/govuk_component/task_list_component/item_component.rb', line 27 def hint @hint end |
#href ⇒ Object (readonly)
Returns the value of attribute href.
27 28 29 |
# File 'app/components/govuk_component/task_list_component/item_component.rb', line 27 def href @href end |
#raw_status ⇒ Object (readonly)
Returns the value of attribute raw_status.
27 28 29 |
# File 'app/components/govuk_component/task_list_component/item_component.rb', line 27 def raw_status @raw_status end |
#raw_title ⇒ Object (readonly)
Returns the value of attribute raw_title.
27 28 29 |
# File 'app/components/govuk_component/task_list_component/item_component.rb', line 27 def raw_title @raw_title end |
Instance Method Details
#call ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'app/components/govuk_component/task_list_component/item_component.rb', line 41 def call adjusted_html_attributes = if href.present? || title&.href.present? html_attributes_with_link_class else html_attributes end tag.li(safe_join([title_content, status_content].compact), **adjusted_html_attributes) end |