Module: Booties::BadgeHelper
- Includes:
- Utils
- Defined in:
- app/helpers/booties/badge_helper.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#badge(content = nil, class: nil, **options, &block) ⇒ Object
Renders a Bootstrap badge.
Methods included from Utils
Instance Method Details
#badge(content = nil, class: nil, **options, &block) ⇒ Object
Renders a Bootstrap badge. The text inside the badge may passed in through content
or with a block. Additional HTML attributes may be passed in through the options
hash.
Examples:
<%= badge 'foo' %>
foo
<%= badge do %>
foo
<% end %>
foo
<%= badge 'foo', id: 'bar' %>
foo
<%= badge 'foo', class: 'bar' %>
27 28 29 30 31 32 |
# File 'app/helpers/booties/badge_helper.rb', line 27 def badge(content = nil, class: nil, **, &block) classes = merge_classes ['badge'], binding.local_variable_get(:class) = { class: classes, ** } content_tag :span, content, , &block end |