diff options
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/commits_helper.rb | 4 | ||||
-rw-r--r-- | app/helpers/merge_requests_helper.rb | 33 |
2 files changed, 29 insertions, 8 deletions
diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb index 111e1cda19c..20a2443f523 100644 --- a/app/helpers/commits_helper.rb +++ b/app/helpers/commits_helper.rb @@ -108,8 +108,8 @@ module CommitsHelper end end - def commit_to_html commit - escape_javascript(render 'projects/commits/commit', commit: commit) + def commit_to_html commit, project + escape_javascript(render 'projects/commits/commit', commit: commit, project: project) unless commit.nil? end def diff_line_content(line) diff --git a/app/helpers/merge_requests_helper.rb b/app/helpers/merge_requests_helper.rb index 05ffec066f8..4ba48aa4339 100644 --- a/app/helpers/merge_requests_helper.rb +++ b/app/helpers/merge_requests_helper.rb @@ -2,14 +2,27 @@ module MergeRequestsHelper def new_mr_path_from_push_event(event) new_project_merge_request_path( event.project, - merge_request: { - source_branch: event.branch_name, - target_branch: event.project.repository.root_ref, - title: event.branch_name.titleize - } + new_mr_from_push_event(event, event.project) ) end + def new_mr_path_for_fork_from_push_event(event) + new_project_merge_request_path( + event.project, + new_mr_from_push_event(event, event.project.forked_from_project) + ) + end + + def new_mr_from_push_event(event, target_project) + return :merge_request => { + source_project_id: event.project.id, + target_project_id: target_project.id, + source_branch: event.branch_name, + target_branch: target_project.repository.root_ref, + title: event.branch_name.titleize + } + end + def mr_css_classes mr classes = "merge-request" classes << " closed" if mr.closed? @@ -18,6 +31,14 @@ module MergeRequestsHelper end def ci_build_details_path merge_request - merge_request.project.gitlab_ci_service.build_page(merge_request.last_commit.sha) + merge_request.source_project.gitlab_ci_service.build_page(merge_request.last_commit.sha) + end + + def merge_path_description(merge_request, separator) + if merge_request.for_fork? + "Project:Branches: #{@merge_request.source_project.path_with_namespace}:#{@merge_request.source_branch} #{separator} #{@merge_request.target_project.path_with_namespace}:#{@merge_request.target_branch}" + else + "Branches: #{@merge_request.source_branch} #{separator} #{@merge_request.target_branch}" + end end end |