Class: CCS::Components::CCS::DashboardSection::Panel
- Defined in:
- lib/ccs/components/ccs/dashboard_section/panel.rb
Overview
CCS Dashboard Section Panel
The individual panel within a dashboard section
Constant Summary collapse
- DEFAULT_ATTRIBUTES =
The default attributes for the dashboard panel
{ class: 'ccs-dashboard-section__panel' }.freeze
Instance Method Summary collapse
-
#initialize(title:, href:, description:, **options) ⇒ Panel
constructor
A new instance of Panel.
-
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the CCS Dashboard Section Panel.
Constructor Details
#initialize(title:, href:, description:, **options) ⇒ Panel
Returns a new instance of Panel.
33 34 35 36 37 38 39 40 41 |
# File 'lib/ccs/components/ccs/dashboard_section/panel.rb', line 33 def initialize(title:, href:, description:, **) super(**) @options[:attributes][:class] << " govuk-grid-column-#{@options[:width] || 'one-third'}" @title = title @href = href @description = description end |
Instance Method Details
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the CCS Dashboard Section Panel
47 48 49 50 51 52 |
# File 'lib/ccs/components/ccs/dashboard_section/panel.rb', line 47 def render tag.div(**[:attributes]) do concat(link_to(title, href, class: 'ccs-dashboard-section__panel-title')) concat(tag.p(description, class: 'ccs-dashboard-section__panel-description')) end end |