mirror of
https://github.com/redmine/redmine.git
synced 2025-12-16 05:20:28 +01:00
code cleanup: rubocop: fix Layout/ElseAlignment in ApplicationHelper#parse_wiki_links
git-svn-id: http://svn.redmine.org/redmine/trunk@18664 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -898,19 +898,26 @@ module ApplicationHelper
|
||||
anchor = sanitize_anchor_name(anchor) if anchor.present?
|
||||
# check if page exists
|
||||
wiki_page = link_project.wiki.find_page(page)
|
||||
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; "#{page.present? ? Wiki.titleize(page) : ''}.html" + (anchor.present? ? "##{anchor}" : '')
|
||||
when :anchor; "##{page.present? ? Wiki.titleize(page) : title}" + (anchor.present? ? "_#{anchor}" : '') # used for single-file wiki export
|
||||
url =
|
||||
if anchor.present? && wiki_page.present? && (obj.is_a?(WikiContent) ||
|
||||
obj.is_a?(WikiContent::Version)) && obj.page == wiki_page
|
||||
"##{anchor}"
|
||||
else
|
||||
wiki_page_id = page.present? ? Wiki.titleize(page) : nil
|
||||
parent = wiki_page.nil? && obj.is_a?(WikiContent) && obj.page && project == link_project ? obj.page.title : nil
|
||||
url_for(:only_path => only_path, :controller => 'wiki', :action => 'show', :project_id => link_project,
|
||||
:id => wiki_page_id, :version => nil, :anchor => anchor, :parent => parent)
|
||||
case options[:wiki_links]
|
||||
when :local
|
||||
"#{page.present? ? Wiki.titleize(page) : ''}.html" + (anchor.present? ? "##{anchor}" : '')
|
||||
when :anchor
|
||||
# used for single-file wiki export
|
||||
"##{page.present? ? Wiki.titleize(page) : title}" + (anchor.present? ? "_#{anchor}" : '')
|
||||
else
|
||||
wiki_page_id = page.present? ? Wiki.titleize(page) : nil
|
||||
parent = wiki_page.nil? && obj.is_a?(WikiContent) && obj.page && project == link_project ? obj.page.title : nil
|
||||
url_for(:only_path => only_path, :controller => 'wiki',
|
||||
:action => 'show', :project_id => link_project,
|
||||
:id => wiki_page_id, :version => nil, :anchor => anchor,
|
||||
:parent => parent)
|
||||
end
|
||||
end
|
||||
end
|
||||
link_to(title.present? ? title.html_safe : h(page), url, :class => ('wiki-page' + (wiki_page ? '' : ' new')))
|
||||
else
|
||||
# project or wiki doesn't exist
|
||||
|
||||
Reference in New Issue
Block a user