module SparkEngine::Helpers::AssetsHelper

Public Instance Methods

asset_tags() click to toggle source
# File lib/spark_engine/helpers/asset_helpers.rb, line 39
def asset_tags
  stylesheet_tag + javascript_tag
end
favicon_tag(*args) click to toggle source
# File lib/spark_engine/helpers/asset_helpers.rb, line 47
def favicon_tag(*args)
  options = 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!(options.symbolize_keys))
end
javascript_tag(*args) click to toggle source
# File lib/spark_engine/helpers/asset_helpers.rb, line 20
def javascript_tag(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  tags = ''

  javascript_url(args).each do |url|
    tags += javascript_include_tag url, options
  end

  tags.html_safe
end
javascript_url(*args) click to toggle source
# 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") click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# File lib/spark_engine/helpers/asset_helpers.rb, line 5
def spark_asset_url(file)
  SparkEngine.plugin.asset_url(file)
end
stylesheet_tag(*args) click to toggle source
# File lib/spark_engine/helpers/asset_helpers.rb, line 9
def stylesheet_tag(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  tags = ''

  stylesheet_url(args).each do |url|
    tags += stylesheet_link_tag url, options
  end

  tags.html_safe
end
stylesheet_url(*args) click to toggle source
# File lib/spark_engine/helpers/asset_helpers.rb, line 31
def stylesheet_url(*args)
  SparkEngine.plugin.stylesheets.urls(args).uniq
end