Sha256: 78a9d2ba2d4985059a2d49b25272c1410223b27b8a204151645e1cb1810e4637
Contents?: true
Size: 1.13 KB
Versions: 4
Compression:
Stored size: 1.13 KB
Contents
module ThemesHelper def image_tag(source, options={}) theme = (options.delete(:theme) == true) tag = super # inject /theme/ into the image tag src if this is themed. tag.gsub!(/src=[\"|\']/) { |m| "#{m}/theme/" }.gsub!("//", "/") if theme tag.gsub(/theme=(.+?)\ /, '') # we need to remove any addition of theme='false' etc. end def javascript_include_tag(*sources) theme = (arguments = sources.dup).extract_options![:theme] == true # don't ruin the current sources object tag = super # inject /theme/ into the javascript include tag src if this is themed. tag.gsub!(/\/javascripts\//, "/theme/javascripts/") if theme tag.gsub(/theme=(.+?)\ /, '') # we need to remove any addition of theme='false' etc. end def stylesheet_link_tag(*sources) theme = (arguments = sources.dup).extract_options![:theme] == true # don't ruin the current sources object tag = super # inject /theme/ into the stylesheet link tag href if this is themed. tag.gsub!(/\/stylesheets\//, "/theme/stylesheets/") if theme tag.gsub(/theme=(.+?)\ /, '') # we need to remove any addition of theme='false' etc. end end
Version data entries
4 entries across 4 versions & 1 rubygems