Module: Trestle::ToolbarsHelper

Defined in:
app/helpers/trestle/toolbars_helper.rb

Overview

Internal

Instance Method Summary collapse

Instance Method Details

#deprecated_toolbar(name) ⇒ Object



18
19
20
21
22
23
# File 'app/helpers/trestle/toolbars_helper.rb', line 18

def deprecated_toolbar(name)
  if content_for?(:"#{name}_toolbar")
    Trestle.deprecator.warn("Using content_for(:#{name}_toolbar) is deprecated. Please use toolbar(:#{name}) instead.")
    content_for(:"#{name}_toolbar")
  end
end

#render_toolbar(toolbar, *args) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/helpers/trestle/toolbars_helper.rb', line 4

def render_toolbar(toolbar, *args)
  result = toolbar.groups(self, *args).map do |items|
    if items.many?
      tag.div(class: "btn-group", role: "group") do
        safe_join(items, "\n")
      end
    else
      items.first
    end
  end

  safe_join(result, "\n")
end