diff options
author | Matthew Landauer <matthew@openaustralia.org> | 2013-02-18 10:01:51 +1100 |
---|---|---|
committer | Matthew Landauer <matthew@openaustralia.org> | 2013-02-18 10:11:55 +1100 |
commit | 7abb45b0549af892b7f1ec2beeca5a42f8c2ef7a (patch) | |
tree | 089a4d9e2e76990f466d12a7d0e1b6ed3d24363e | |
parent | 40466d7da8d292e47d9f29414cd5721b006e298c (diff) |
Reinstate main_url and admin_url helpers with deprecation warning
-rwxr-xr-x | app/helpers/link_to_helper.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb index ea12fbb5c..cd60ba5ef 100755 --- a/app/helpers/link_to_helper.rb +++ b/app/helpers/link_to_helper.rb @@ -244,6 +244,32 @@ module LinkToHelper link_to h(query), search_url(query) end + # Deprecated helper + # TODO: Remove in next release + def admin_url(relative_path) + warn "[DEPRECATION] admin_url is deprecated. Please remove it from your theme." + relative_path + end + + # Deprecated helper + # TODO: Remove in next release + def main_url(relative_path, append = nil) + warn "[DEPRECATION] main_url is deprecated. Please remove it from your theme." + url_prefix = "http://" + Configuration::domain + url = url_prefix + relative_path + if !append.nil? + begin + env = Rack::MockRequest.env_for(url) + req = Rack::Request.new(env) + req.path_info += append + url = req.url + rescue URI::InvalidURIError + # don't append to it + end + end + return url + end + # About page URLs def about_url return help_general_url(:action => 'about') |