Module: ActionView::Helpers::AssetTagHelper

Defined in:
lib/emcee/helpers/asset_tag_helper.rb

Instance Method Summary collapse

Instance Method Details

#html_import_tag(*sources) ⇒ Object

Custom view helper used to create an html import. Will search the asset directories for the sources.

html_import_tag("navigation")


9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/emcee/helpers/asset_tag_helper.rb', line 9

def html_import_tag(*sources)
  options = sources.extract_options!.stringify_keys
  path_options = options.extract!('protocol').symbolize_keys

  sources.uniq.map { |source|
    tag_options = {
      "rel" => "import",
      "href" => path_to_html(source, path_options)
    }.merge!(options)
    tag(:link, tag_options)
  }.join("\n").html_safe
end