Module: ThemesHelper

Defined in:
vendor/plugins/themes/app/helpers/themes_helper.rb

Instance Method Summary collapse

Instance Method Details

#image_tag(source, options = {}) ⇒ Object



2
3
4
5
6
7
8
# File 'vendor/plugins/themes/app/helpers/themes_helper.rb', line 2

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

#javascript_include_tag(*sources) ⇒ Object



10
11
12
13
14
15
16
# File 'vendor/plugins/themes/app/helpers/themes_helper.rb', line 10

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


18
19
20
21
22
23
24
# File 'vendor/plugins/themes/app/helpers/themes_helper.rb', line 18

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