diff options
author | mhasbini <mohammad.hasbini@gmail.com> | 2017-03-09 02:14:16 +0200 |
---|---|---|
committer | mhasbini <mohammad.hasbini@gmail.com> | 2017-03-09 02:14:16 +0200 |
commit | ac669df526a8cf42cd990b93f5a3f8f87e3eff9d (patch) | |
tree | 2e448c8aab0e3dc1294ddd54afcd6a2bdfab9620 /app/helpers | |
parent | f5c174a48498ed2743f42a0dc7eb659a89eb5945 (diff) | |
download | gitlab-ce-ac669df526a8cf42cd990b93f5a3f8f87e3eff9d.tar.gz |
link issuable reference to itself in header
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/issuables_helper.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb index c2b399041c6..aad83731b87 100644 --- a/app/helpers/issuables_helper.rb +++ b/app/helpers/issuables_helper.rb @@ -1,4 +1,6 @@ module IssuablesHelper + include GitlabRoutingHelper + def sidebar_gutter_toggle_icon sidebar_gutter_collapsed? ? icon('angle-double-left', { 'aria-hidden': 'true' }) : icon('angle-double-right', { 'aria-hidden': 'true' }) end @@ -95,8 +97,23 @@ module IssuablesHelper h(milestone_title.presence || default_label) end + def to_url_reference(issuable) + case issuable + when Issue + link_to issuable.to_reference, issue_url(issuable) + when MergeRequest + link_to issuable.to_reference, merge_request_url(issuable) + else + issuable.to_reference + end + end + def issuable_meta(issuable, project, text) - output = content_tag :strong, "#{text} #{issuable.to_reference}", class: "identifier" + output = content_tag(:strong, class: "identifier") do + concat("#{text} ") + concat(to_url_reference(issuable)) + end + output << " opened #{time_ago_with_tooltip(issuable.created_at)} by ".html_safe output << content_tag(:strong) do author_output = link_to_member(project, issuable.author, size: 24, mobile_classes: "hidden-xs", tooltip: true) |