gitlab-org--gitlab-foss/app/helpers/compare_helper.rb
2015-09-09 14:37:34 +02:00

21 lines
590 B
Ruby

module CompareHelper
def create_mr_button?(from = params[:from], to = params[:to], project = @project)
from.present? &&
to.present? &&
from != to &&
project.merge_requests_enabled &&
project.repository.branch_names.include?(from) &&
project.repository.branch_names.include?(to)
end
def create_mr_path(from = params[:from], to = params[:to], project = @project)
new_namespace_project_merge_request_path(
project.namespace,
project,
merge_request: {
source_branch: to,
target_branch: from
}
)
end
end