Module: Trestle::ToolbarsHelper

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

Instance Method Summary collapse

Instance Method Details

#deprecated_toolbar(name) ⇒ Object


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

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

#render_toolbar(toolbar, *args) ⇒ Object


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

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

  safe_join(result, "\n")
end