Class: CCS::Components::GovUK::TaskList::Item::Status
- Defined in:
- lib/ccs/components/govuk/task_list/item/status.rb
Overview
GOV.UK Task list item status
Constant Summary collapse
- DEFAULT_ATTRIBUTES =
The default attributes for the task list item status
{ class: 'govuk-task-list__status' }.freeze
Instance Method Summary collapse
-
#initialize(id_prefix:, tag_options: nil, text: nil, **options) ⇒ Status
constructor
A new instance of Status.
-
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Task list item status.
Constructor Details
#initialize(id_prefix:, tag_options: nil, text: nil, **options) ⇒ Status
Returns a new instance of Status.
34 35 36 37 38 39 40 |
# File 'lib/ccs/components/govuk/task_list/item/status.rb', line 34 def initialize(id_prefix:, tag_options: nil, text: nil, **) super(**) @options[:attributes][:id] = "#{id_prefix}-status" @text = text @tag_component = Tag.new(context: @context, **) if end |
Instance Method Details
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Task list item status
46 47 48 49 50 51 52 53 54 |
# File 'lib/ccs/components/govuk/task_list/item/status.rb', line 46 def render tag.div(class: @options[:attributes][:class], id: @options[:attributes][:id]) do if tag_component tag_component.render else text end end end |