summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-07-30 13:35:33 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-07-30 13:35:33 +0300
commit0d715bcd812ca6c99884e117f28a400669aa8e57 (patch)
tree5690fa43c790af40c51441425b9d8be068d4139d /app/helpers
parent4f07a6a99cab8f8ae3ad0a786a6cc9a837955c08 (diff)
parent4d373005968b8269a8d2fe56b7776820396127a4 (diff)
downloadgitlab-ce-0d715bcd812ca6c99884e117f28a400669aa8e57.tar.gz
Merge branch 'mr-on-fork' of https://github.com/karlhungus/gitlabhq into karlhungus-mr-on-fork
Conflicts: app/views/projects/commit/show.html.haml app/views/projects/compare/show.html.haml app/views/projects/merge_requests/branch_from.js.haml
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/commits_helper.rb4
-rw-r--r--app/helpers/merge_requests_helper.rb33
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