diff options
author | Phil Hughes <me@iamphill.com> | 2016-04-01 12:20:54 +0100 |
---|---|---|
committer | Jacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home> | 2016-04-16 16:13:16 -0400 |
commit | 6c949b2bf1c9ee47fb5b181f44021ad6eeb1cd5a (patch) | |
tree | f445652a9abc5dccf0dc52bb73e43e9dd8fd9688 | |
parent | 60bb7007c3a165543a1787aa7ee6543a0def2152 (diff) | |
download | gitlab-ce-6c949b2bf1c9ee47fb5b181f44021ad6eeb1cd5a.tar.gz |
Moved meta information into an issuable helper method
-rw-r--r-- | app/helpers/issuables_helper.rb | 11 | ||||
-rw-r--r-- | app/views/projects/issues/show.html.haml | 9 | ||||
-rw-r--r-- | app/views/projects/merge_requests/show/_mr_title.html.haml | 11 |
3 files changed, 14 insertions, 17 deletions
diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb index b14b8218d02..94e1a4d2ec1 100644 --- a/app/helpers/issuables_helper.rb +++ b/app/helpers/issuables_helper.rb @@ -55,6 +55,17 @@ module IssuablesHelper h(milestone_title.presence || default_label) end + def issuable_meta(issuable, project, text) + output = content_tag :strong, "#{text} #{issuable.to_reference}", class: "identifier" + output << " opened " + output << time_ago_with_tooltip(issuable.created_at) + output << " by " + output << content_tag(:strong) do + author_output = link_to_member(project, issuable.author, size: 24, mobile_classes: "hidden-xs") + author_output << link_to_member(project, issuable.author, size: 24, by_username: true, avatar: false, mobile_classes: "hidden-sm hidden-md hidden-lg") + end + end + private def sidebar_gutter_collapsed? diff --git a/app/views/projects/issues/show.html.haml b/app/views/projects/issues/show.html.haml index 4f4e6c59d63..e3df2ec9241 100644 --- a/app/views/projects/issues/show.html.haml +++ b/app/views/projects/issues/show.html.haml @@ -18,14 +18,7 @@ .issuable-meta = confidential_icon(@issue) - %strong.identifier - Issue #{@issue.to_reference} - opened - = time_ago_with_tooltip(@issue.created_at) - by - %strong - = link_to_member(@project, @issue.author, size: 24, mobile_classes: "hidden-xs") - = link_to_member(@project, @issue.author, size: 24, by_username: true, avatar: false, mobile_classes: "hidden-sm hidden-md hidden-lg") + = issuable_meta(@issue, @project, "Issue") .issuable-actions .clearfix.issue-btn-group.dropdown diff --git a/app/views/projects/merge_requests/show/_mr_title.html.haml b/app/views/projects/merge_requests/show/_mr_title.html.haml index c4e57883259..e78fd2054ce 100644 --- a/app/views/projects/merge_requests/show/_mr_title.html.haml +++ b/app/views/projects/merge_requests/show/_mr_title.html.haml @@ -7,16 +7,9 @@ %a.btn.btn-default.pull-right.visible-xs-block.gutter-toggle.issuable-gutter-toggle.js-sidebar-toggle{ href: "#" } = icon('angle-double-left') - + .issuable-meta - %strong.identifier - Merge Request #{@merge_request.to_reference} - opened - = time_ago_with_tooltip(@merge_request.created_at) - by - %strong - = link_to_member(@project, @merge_request.author, size: 24, mobile_classes: "hidden-xs") - = link_to_member(@project, @merge_request.author, size: 24, mobile_classes: "hidden-sm hidden-md hidden-lg", by_username: true, avatar: false) + = issuable_meta(@merge_request, @project, "Merge Request") - if can?(current_user, :update_merge_request, @merge_request) .issuable-actions |