mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-13 14:46:05 +10:00
Properly link to the right issue or merge request
This commit is contained in:
@@ -293,6 +293,26 @@ module ApplicationHelper
|
||||
end
|
||||
end
|
||||
|
||||
def issuable_link_next(project,issuable)
|
||||
if project.nil?
|
||||
nil
|
||||
elsif current_controller?(:issues)
|
||||
namespace_project_issue_path(project.namespace, project, next_issuable_for(project, issuable.id).try(:iid))
|
||||
elsif current_controller?(:merge_requests)
|
||||
namespace_project_merge_request_path(project.namespace, project, next_issuable_for(project, issuable.id).try(:iid))
|
||||
end
|
||||
end
|
||||
|
||||
def issuable_link_prev(project,issuable)
|
||||
if project.nil?
|
||||
nil
|
||||
elsif current_controller?(:issues)
|
||||
namespace_project_issue_path(project.namespace, project, prev_issuable_for(project, issuable.id).try(:iid))
|
||||
elsif current_controller?(:merge_requests)
|
||||
namespace_project_merge_request_path(project.namespace, project, prev_issuable_for(project, issuable.id).try(:iid))
|
||||
end
|
||||
end
|
||||
|
||||
def issuable_count(entity, project)
|
||||
if project.nil?
|
||||
0
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
= icon('angle-double-right')
|
||||
.issuable-nav.pull-right.btn-group{role: 'group', "aria-label" => '...'}
|
||||
- if has_prev_issuable?(@project, issuable.id)
|
||||
= link_to 'Prev', namespace_project_issue_path(@project.namespace, @project, prev_issuable_for(@project, issuable.id).try(:iid)), class: 'btn btn-default'
|
||||
= link_to 'Prev', issuable_link_prev(@project, issuable), class: 'btn btn-default'
|
||||
- else
|
||||
%a.btn.btn-default.disabled{href: '#'}
|
||||
Prev
|
||||
- if has_next_issuable?(@project, issuable.id)
|
||||
= link_to 'Next', namespace_project_issue_path(@project.namespace, @project, next_issuable_for(@project, issuable.id).try(:iid)), class: 'btn btn-default'
|
||||
= link_to 'Next', issuable_link_next(@project, issuable), class: 'btn btn-default'
|
||||
- else
|
||||
%a.btn.btn-default.disabled{href: '#'}
|
||||
Next
|
||||
|
||||
Reference in New Issue
Block a user