Sha256: dbeafb921c0ab5cd10a1edaf6a3d40455cba27d82fe3637c5fcdadc3db695af7

Contents?: true

Size: 813 Bytes

Versions: 7

Compression:

Stored size: 813 Bytes

Contents

<%
  start ||= false
  href ||= false
  info_text ||= false
  rel ||= false
  text ||= ""
  margin_bottom ||= false
  data_attributes ||= false
  title ||= false
  css_classes = %w(gem-c-button)
  css_classes << "gem-c-button--start" if start
  css_classes << "gem-c-button--bottom-margin" if margin_bottom
  css_classes = css_classes.join(" ")
  html_options = { class: css_classes }
  html_options[:role] = "button" if href
  html_options[:rel] = rel if rel
  html_options[:data] = data_attributes if data_attributes
  html_options[:title] = title if title
%>
<% if href %>
  <%= link_to(text, href.try(:html_safe), html_options) %>
<% else %>
  <%= button_tag(text, html_options) %>
<% end %>
<% if info_text %>
  <span class="gem-c-button__info-text">
    <%= info_text.try(:html_safe) %>
  </span>
<% end %>

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
govuk_publishing_components-7.3.0 app/views/govuk_publishing_components/components/_button.html.erb
govuk_publishing_components-7.2.0 app/views/govuk_publishing_components/components/_button.html.erb
govuk_publishing_components-7.1.0 app/views/govuk_publishing_components/components/_button.html.erb
govuk_publishing_components-7.0.0 app/views/govuk_publishing_components/components/_button.html.erb
govuk_publishing_components-6.7.0 app/views/govuk_publishing_components/components/_button.html.erb
govuk_publishing_components-6.6.0 app/views/govuk_publishing_components/components/_button.html.erb
govuk_publishing_components-6.5.0 app/views/govuk_publishing_components/components/_button.html.erb