Sha256: 21c2286548672126ee096f447144d3baefed28f09504adc015b361f6fd95c93d
Contents?: true
Size: 1.15 KB
Versions: 6
Compression:
Stored size: 1.15 KB
Contents
require 'action_view' module GovukPublishingComponents module Presenters class ButtonHelper attr_reader :href, :text, :title, :info_text, :rel, :data_attributes, :start, :margin_bottom def initialize(local_assigns) @href = local_assigns[:href] @text = local_assigns[:text] @title = local_assigns[:title] @info_text = local_assigns[:info_text] @rel = local_assigns[:rel] @data_attributes = local_assigns[:data_attributes] @start = local_assigns[:start] @margin_bottom = local_assigns[:margin_bottom] end def link? href.present? end def html_options options = { class: css_classes } options[:role] = "button" if link? options[:rel] = rel if rel options[:data] = data_attributes if data_attributes options[:title] = title if title options end private def css_classes classes = %w(gem-c-button govuk-button) classes << "govuk-button--start" if start classes << "gem-c-button--bottom-margin" if margin_bottom classes.join(" ") end end end end
Version data entries
6 entries across 6 versions & 1 rubygems