Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-05-09 23:26:25 +0300
committerDouwe Maan <douwe@gitlab.com>2015-05-09 23:26:52 +0300
commit722e3935893e0493e5783f1a61034fe1481f8cb8 (patch)
tree9f051a8e42f0659adde57027b67efb3365de279d /app/helpers/compare_helper.rb
parent8f75ab21d021fb5335ed9e084157cf2bc06caca1 (diff)
Add Create Merge Request buttons to commits page and push event.
Diffstat (limited to 'app/helpers/compare_helper.rb')
-rw-r--r--app/helpers/compare_helper.rb24
1 files changed, 12 insertions, 12 deletions
diff --git a/app/helpers/compare_helper.rb b/app/helpers/compare_helper.rb
index 01847c6b807..fe339d32155 100644
--- a/app/helpers/compare_helper.rb
+++ b/app/helpers/compare_helper.rb
@@ -1,21 +1,21 @@
module CompareHelper
- def compare_to_mr_button?
- @project.merge_requests_enabled &&
- params[:from].present? &&
- params[:to].present? &&
- @repository.branch_names.include?(params[:from]) &&
- @repository.branch_names.include?(params[:to]) &&
- params[:from] != params[:to] &&
+ def create_mr_button?(from = params[:from], to = params[:to], project = @project)
+ project.merge_requests_enabled &&
+ from.present? &&
+ to.present? &&
+ project.repository.branch_names.include?(from) &&
+ project.repository.branch_names.include?(to) &&
+ from != to &&
!@refs_are_same
end
- def compare_mr_path
+ def create_mr_path(from = params[:from], to = params[:to], project = @project)
new_namespace_project_merge_request_path(
- @project.namespace,
- @project,
+ project.namespace,
+ project,
merge_request: {
- source_branch: params[:to],
- target_branch: params[:from]
+ source_branch: to,
+ target_branch: from
}
)
end