Module: Iron::UiHelper

Included in:
ApplicationHelper
Defined in:
app/helpers/iron/ui_helper.rb

Instance Method Summary collapse

Instance Method Details

#back_button_to(title, url, options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/iron/ui_helper.rb', line 3

def back_button_to(title, url, options = {}, &)
  link_to url,
    class: tw(
      "inline-flex items-center gap-2 text-sm/6 text-stone-500 dark:text-stone-400",
      options.delete(:class)
    ) do
    safe_join([
      icon("chevron-left", class: "size-4"),
      tag.span(title)
    ])
  end
end

#badge(content = nil, **options, &block) ⇒ Object



16
17
18
19
20
# File 'app/helpers/iron/ui_helper.rb', line 16

def badge(content = nil, **options, &block)
  tag.span class: tw("badge", options.delete(:class)), **options do
    block_given? ? capture(&block) : content
  end
end