-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
decouple themes from the main application some more
- Loading branch information
Showing
3 changed files
with
27 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters