Module: SparkEngine::Helpers::AssetsHelper
- Defined in:
- lib/spark_engine/helpers/asset_helpers.rb
Instance Method Summary collapse
- #asset_tags ⇒ Object
- #favicon_tag(*args) ⇒ Object
- #javascript_tag(*args) ⇒ Object
- #javascript_url(*args) ⇒ Object
- #pin_tab_icon_tag(path, color = "black") ⇒ Object
- #sass_data(key = nil) ⇒ Object
- #spark_asset_url(file) ⇒ Object
- #stylesheet_tag(*args) ⇒ Object
- #stylesheet_url(*args) ⇒ Object
Instance Method Details
#asset_tags ⇒ Object
39 40 41 |
# File 'lib/spark_engine/helpers/asset_helpers.rb', line 39 def stylesheet_tag + javascript_tag end |
#favicon_tag(*args) ⇒ Object
47 48 49 50 51 52 53 54 55 |
# File 'lib/spark_engine/helpers/asset_helpers.rb', line 47 def favicon_tag(*args) = args.last.is_a?(Hash) ? args.pop : {} source = args.first || 'favicon.ico' tag('link', { :rel => 'shortcut icon', :type => 'image/x-icon', :href => spark_asset_url(source) }.merge!(.symbolize_keys)) end |
#javascript_tag(*args) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/spark_engine/helpers/asset_helpers.rb', line 20 def javascript_tag(*args) = args.last.is_a?(Hash) ? args.pop : {} = '' javascript_url(args).each do |url| += javascript_include_tag url, end .html_safe end |
#javascript_url(*args) ⇒ Object
35 36 37 |
# File 'lib/spark_engine/helpers/asset_helpers.rb', line 35 def javascript_url(*args) SparkEngine.plugin.javascripts.urls(args).uniq end |
#pin_tab_icon_tag(path, color = "black") ⇒ Object
43 44 45 |
# File 'lib/spark_engine/helpers/asset_helpers.rb', line 43 def pin_tab_icon_tag(path, color="black") %Q{<link rel="mask-icon" mask href="#{spark_asset_url(path)}" color="#{color}">}.html_safe end |
#sass_data(key = nil) ⇒ Object
57 58 59 60 61 62 63 64 |
# File 'lib/spark_engine/helpers/asset_helpers.rb', line 57 def sass_data(key=nil) require 'spark_engine/sass/sass_yaml' if key SparkEngine.plugin.stylesheets.data[key] else SparkEngine.plugin.stylesheets.data end end |
#spark_asset_url(file) ⇒ Object
5 6 7 |
# File 'lib/spark_engine/helpers/asset_helpers.rb', line 5 def spark_asset_url(file) SparkEngine.plugin.asset_url(file) end |
#stylesheet_tag(*args) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/spark_engine/helpers/asset_helpers.rb', line 9 def stylesheet_tag(*args) = args.last.is_a?(Hash) ? args.pop : {} = '' stylesheet_url(args).each do |url| += stylesheet_link_tag url, end .html_safe end |
#stylesheet_url(*args) ⇒ Object
31 32 33 |
# File 'lib/spark_engine/helpers/asset_helpers.rb', line 31 def stylesheet_url(*args) SparkEngine.plugin.stylesheets.urls(args).uniq end |