Sha256: 75eaef9814699cd7284a39cc390e6486f0c9454e3e113aae52b2826f2ea026bb

Contents?: true

Size: 1.13 KB

Versions: 3

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

3 entries across 3 versions & 2 rubygems

Version Path
jacobat-refinerycms-0.9.6.14 vendor/plugins/themes/app/helpers/themes_helper.rb
refinerycms-0.9.6.14 vendor/plugins/themes/app/helpers/themes_helper.rb
refinerycms-0.9.6.13 vendor/plugins/themes/app/helpers/themes_helper.rb