diff options
author | Etienne Massip <etienne.massip@gmail.com> | 2011-10-02 14:44:07 +0000 |
---|---|---|
committer | Etienne Massip <etienne.massip@gmail.com> | 2011-10-02 14:44:07 +0000 |
commit | 1ee65e046913ede620c7dd989081bb61d8a8c198 (patch) | |
tree | 11610ffb66f439d3fafdbff960538e726cd645a2 /app/helpers | |
parent | e2f57b5874957261992a690eb1eae3c70cde69ac (diff) | |
download | redmine-1ee65e046913ede620c7dd989081bb61d8a8c198.tar.gz redmine-1ee65e046913ede620c7dd989081bb61d8a8c198.zip |
Use local links in wiki pages when possible (#3276).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7558 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/application_helper.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 193c93e9a..dce6913a3 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -572,13 +572,17 @@ module ApplicationHelper end # check if page exists wiki_page = link_project.wiki.find_page(page) - url = case options[:wiki_links] + url = if anchor.present? && wiki_page.present? && (obj.is_a?(WikiContent) || obj.is_a?(WikiContent::Version)) && obj.page == wiki_page + "##{anchor}" + else + case options[:wiki_links] when :local; "#{title}.html" when :anchor; "##{title}" # used for single-file wiki export else wiki_page_id = page.present? ? Wiki.titleize(page) : nil url_for(:only_path => only_path, :controller => 'wiki', :action => 'show', :project_id => link_project, :id => wiki_page_id, :anchor => anchor) end + end link_to(h(title || page), url, :class => ('wiki-page' + (wiki_page ? '' : ' new'))) else # project or wiki doesn't exist |