Module: Bastion::LayoutHelper

Defined in:
app/helpers/bastion/layout_helper.rb

Instance Method Summary collapse

Instance Method Details

#include_plugin_js(plugin) ⇒ Object



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

def include_plugin_js(plugin)
  return unless plugin[:javascript]

  if plugin[:javascript].is_a?(Proc)
    js = instance_eval(&plugin[:javascript])
    js = js.join("\n") if js.is_a?(Array)
    js.html_safe
  else
    javascript_include_tag(plugin[:javascript])
  end
end

#include_plugin_styles(plugin) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'app/helpers/bastion/layout_helper.rb', line 15

def include_plugin_styles(plugin)
  return unless plugin[:stylesheet]

  if plugin[:stylesheet].is_a?(Proc)
    styles = instance_eval(&plugin[:stylesheet])
    styles = styles.join("\n") if styles.is_a?(Array)
    styles.html_safe
  else
    stylesheet_link_tag(plugin[:stylesheet])
  end
end