Class: GovukPublishingComponents::AppHelpers::TableHelper
- Inherits:
-
Object
- Object
- GovukPublishingComponents::AppHelpers::TableHelper
- Defined in:
- lib/govuk_publishing_components/app_helpers/table_helper.rb
Defined Under Namespace
Classes: TableBuilder
Class Method Summary collapse
-
.helper(context, caption = nil, opt = {}) ⇒ Object
This is part of the Public API of this gem Any non-backwards compatible changes to the signature will require a major version change.
Class Method Details
.helper(context, caption = nil, opt = {}) ⇒ Object
This is part of the Public API of this gem Any non-backwards compatible changes to the signature will require a major version change
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/govuk_publishing_components/app_helpers/table_helper.rb', line 6 def self.helper(context, = nil, opt = {}) builder = TableBuilder.new(context.tag) classes = %w[gem-c-table govuk-table] classes << "govuk-table--sortable" if opt[:sortable] = %w[govuk-table__caption] << opt[:caption_classes] if opt[:caption_classes] context.tag.table class: classes, id: opt[:table_id] do context.concat context.tag. , class: yield(builder) end end |