Sha256: 181fa1812bb5c282233cc2869aef34f87d5e79e546fa6c4c90d13abe076dab8d

Contents?: true

Size: 1.46 KB

Versions: 31

Compression:

Stored size: 1.46 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

  def image_submit_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
end

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
refinerycms-0.9.7.15 vendor/plugins/themes/app/helpers/themes_helper.rb
refinerycms-0.9.7.14 vendor/plugins/themes/app/helpers/themes_helper.rb
refinerycms-theming-0.9.8 app/helpers/themes_helper.rb
refinerycms-0.9.7.13 vendor/plugins/themes/app/helpers/themes_helper.rb
refinerycms-0.9.7.11 vendor/plugins/themes/app/helpers/themes_helper.rb
refinerycms-0.9.7.10 vendor/plugins/themes/app/helpers/themes_helper.rb
refinerycms-0.9.7.9 vendor/plugins/themes/app/helpers/themes_helper.rb
refinerycms-0.9.7.8 vendor/plugins/themes/app/helpers/themes_helper.rb
refinerycms-0.9.7.7 vendor/plugins/themes/app/helpers/themes_helper.rb
refinerycms-0.9.7.6 vendor/plugins/themes/app/helpers/themes_helper.rb
refinerycms-0.9.7.5 vendor/plugins/themes/app/helpers/themes_helper.rb
refinerycms-0.9.7.4 vendor/plugins/themes/app/helpers/themes_helper.rb
refinerycms-0.9.7.3 vendor/plugins/themes/app/helpers/themes_helper.rb
refinerycms-0.9.7.2 vendor/plugins/themes/app/helpers/themes_helper.rb
refinerycms-0.9.7.1 vendor/plugins/themes/app/helpers/themes_helper.rb
refinerycms-0.9.7 vendor/plugins/themes/app/helpers/themes_helper.rb
refinerycms-0.9.6.34 vendor/plugins/themes/app/helpers/themes_helper.rb
refinerycms-0.9.6.33 vendor/plugins/themes/app/helpers/themes_helper.rb
refinerycms-0.9.6.32 vendor/plugins/themes/app/helpers/themes_helper.rb
refinerycms-0.9.6.31 vendor/plugins/themes/app/helpers/themes_helper.rb