Satisfy code climate

pull/6421/head
Wieland Lindenthal 6 years ago
parent 73798cd2ae
commit 42f87154cd
  1. 17
      lib/open_project/page_hierarchy_helper.rb

@ -50,14 +50,7 @@ module OpenProject
def render_hierarchy_item(page, is_parent, options = {}) def render_hierarchy_item(page, is_parent, options = {})
content_tag(:span, class: 'tree-menu--item', slug: page.slug) do content_tag(:span, class: 'tree-menu--item', slug: page.slug) do
hierarchy_span_content = if is_parent concat content_tag(:span, hierarchy_span_content(is_parent), class: 'tree-menu--hierarchy-span')
render_hierarchy_indicator_icons
else
render_leaf_indicator
end
concat content_tag(:span, hierarchy_span_content, class: 'tree-menu--hierarchy-span')
concat link_to(page.title, concat link_to(page.title,
Rails.application.routes.url_helpers.project_wiki_path(page.project, page), Rails.application.routes.url_helpers.project_wiki_path(page.project, page),
title: hierarchy_item_title(options, page), title: hierarchy_item_title(options, page),
@ -66,6 +59,14 @@ module OpenProject
end end
end end
def hierarchy_span_content(is_parent)
if is_parent
render_hierarchy_indicator_icons
else
render_leaf_indicator
end
end
def hierarchy_item_title(options, page) def hierarchy_item_title(options, page)
if options[:timestamp] && page.updated_on if options[:timestamp] && page.updated_on
::I18n.t(:label_updated_time, value: distance_of_time_in_words(Time.now, page.updated_on)) ::I18n.t(:label_updated_time, value: distance_of_time_in_words(Time.now, page.updated_on))

Loading…
Cancel
Save