debian-mirror-gitlab/app/helpers/compare_helper.rb

21 lines
561 B
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
module CompareHelper
2015-09-11 14:41:01 +05:30
def create_mr_button?(from = params[:from], to = params[:to], project = @project)
from.present? &&
to.present? &&
from != to &&
2017-08-17 22:00:37 +05:30
can?(current_user, :create_merge_request, project) &&
2018-03-17 18:26:18 +05:30
project.repository.branch_exists?(from) &&
project.repository.branch_exists?(to)
2014-09-02 18:07:02 +05:30
end
2015-09-11 14:41:01 +05:30
def create_mr_path(from = params[:from], to = params[:to], project = @project)
2017-09-10 17:25:29 +05:30
project_new_merge_request_path(
2015-09-11 14:41:01 +05:30
project,
2015-04-26 12:48:37 +05:30
merge_request: {
2015-09-11 14:41:01 +05:30
source_branch: to,
target_branch: from
2015-04-26 12:48:37 +05:30
}
)
2014-09-02 18:07:02 +05:30
end
end