Module: Graspi::AssetsIncludeHelper
- Defined in:
- lib/graspi/helpers/assets_include_helper.rb
Instance Method Summary collapse
- #graspi_file_path(path) ⇒ Object
- #graspi_image_tag(path, options = {}) ⇒ Object
- #graspi_image_url(path) ⇒ Object
- #graspi_javascript_include_tag(*sources) ⇒ Object
- #graspi_stylesheet_link_tag(*sources) ⇒ Object
Instance Method Details
#graspi_file_path(path) ⇒ Object
38 39 40 41 42 |
# File 'lib/graspi/helpers/assets_include_helper.rb', line 38 def graspi_file_path(path) mapping = Graspi.manifest(Rails.env) mapping[path] end |
#graspi_image_tag(path, options = {}) ⇒ Object
32 33 34 35 36 |
# File 'lib/graspi/helpers/assets_include_helper.rb', line 32 def graspi_image_tag(path, = {}) = .merge({ src: graspi_file_path(path) }) tag(:img, ) end |
#graspi_image_url(path) ⇒ Object
28 29 30 |
# File 'lib/graspi/helpers/assets_include_helper.rb', line 28 def graspi_image_url(path) graspi_file_path(path) end |
#graspi_javascript_include_tag(*sources) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/graspi/helpers/assets_include_helper.rb', line 17 def graspi_javascript_include_tag(*sources) = sources..stringify_keys sources.uniq.map { |source| = { "src" => graspi_file_path("#{source}.js") }.merge!() content_tag(:script, "", ) }.join("\n").html_safe end |
#graspi_stylesheet_link_tag(*sources) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/graspi/helpers/assets_include_helper.rb', line 4 def graspi_stylesheet_link_tag(*sources) = sources..stringify_keys sources.uniq.map { |source| = { "rel" => "stylesheet", "media" => "screen", "href" => graspi_file_path("#{source}.css") }.merge!() tag(:link, ) }.join("\n").html_safe end |