aboutsummaryrefslogtreecommitdiffstats
path: root/app/helpers/application_helper.rb
diff options
context:
space:
mode:
authorMarc Florisson2012-09-18 18:07:40 +0200
committerMarc Florisson2012-09-18 18:07:40 +0200
commitd91e2b97fae4ae391f646ef1444e1b7f06704425 (patch)
tree8cd07b00eaa40496bf136f3fd0bc5764f2dcdf82 /app/helpers/application_helper.rb
parent295f7876004a9c7c048ce627f98af6755f8470e2 (diff)
downloadchouette-core-d91e2b97fae4ae391f646ef1444e1b7f06704425.tar.bz2
refactor polymorphic path patch
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r--app/helpers/application_helper.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 797aab166..3b5bfdfda 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -4,6 +4,17 @@ module ApplicationHelper
@referential.present? and not @referential.new_record?
end
+ def polymorphic_path_patch( source)
+ relative_url_root = Rails.application.config.relative_url_root
+ relative_url_root && !source.starts_with?("#{relative_url_root}/") ? "#{relative_url_root}#{source}" : source
+ end
+ def assets_path_patch( source)
+ relative_url_root = Rails.application.config.relative_url_root
+ return "/assets/#{source}" unless relative_url_root
+ "#{relative_url_root}/assets/#{source}"
+ end
+
+
def help_page?
controller_name == "help"
end