2013-09-12 17:15:10 +00:00
|
|
|
module CompareHelper
|
2015-05-09 20:26:25 +00:00
|
|
|
def create_mr_button?(from = params[:from], to = params[:to], project = @project)
|
2015-05-09 21:51:50 +00:00
|
|
|
from.present? &&
|
2015-05-09 20:26:25 +00:00
|
|
|
to.present? &&
|
|
|
|
from != to &&
|
2018-04-06 12:18:58 +00:00
|
|
|
can?(current_user, :create_merge_request_from, project) &&
|
2017-10-10 14:56:04 +00:00
|
|
|
project.repository.branch_exists?(from) &&
|
|
|
|
project.repository.branch_exists?(to)
|
2013-09-12 17:15:10 +00:00
|
|
|
end
|
|
|
|
|
2015-05-09 20:26:25 +00:00
|
|
|
def create_mr_path(from = params[:from], to = params[:to], project = @project)
|
2017-06-29 17:06:35 +00:00
|
|
|
project_new_merge_request_path(
|
2015-05-09 20:26:25 +00:00
|
|
|
project,
|
2015-01-24 18:02:58 +00:00
|
|
|
merge_request: {
|
2015-05-09 20:26:25 +00:00
|
|
|
source_branch: to,
|
|
|
|
target_branch: from
|
2015-01-24 18:02:58 +00:00
|
|
|
}
|
|
|
|
)
|
2013-09-12 17:15:10 +00:00
|
|
|
end
|
|
|
|
end
|