Browse Source

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
tags/4.1.0
Toshi MARUYAMA 4 years ago
parent
commit
76ed5c7cc3
1 changed files with 18 additions and 11 deletions
  1. 18
    11
      app/helpers/application_helper.rb

+ 18
- 11
app/helpers/application_helper.rb View File

@@ -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

Loading…
Cancel
Save