Module: ActionView::Helpers::AssetTagHelper

Extended by:
ActiveSupport::Concern
Includes:
AssetUrlHelper, TagHelper
Defined in:
lib/amelia/action_view/helpers/asset_tag_helper.rb

Overview

This module provides methods for generating HTML that links views to assets such as images, JavaScripts, stylesheets, and feeds. These methods do not verify the assets exist before linking to them:

image_tag("rails.png")
# => <img alt="Rails" src="/assets/rails.png" />
stylesheet_link_tag("application")
# => <link href="/assets/application.css?body=1" media="screen" rel="stylesheet" />

Instance Method Summary collapse

Methods included from TagHelper

#content_tag

Instance Method Details

#javascript_include_tag(*sources) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/amelia/action_view/helpers/asset_tag_helper.rb', line 23

def javascript_include_tag(*sources)
  options = sources.extract_options!.stringify_keys
  path_options = options.extract!('protocol', 'extname').symbolize_keys
  sources.uniq.map { |source|
    tag_options = {
      "src" => path_to_javascript(source, path_options)
    }.merge!(options)
    (:script, "", tag_options, true, false)
  }.join("\n").html_safe
end