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

22 lines
610 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) &&
2015-09-11 14:41:01 +05:30
project.repository.branch_names.include?(from) &&
project.repository.branch_names.include?(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)
2015-04-26 12:48:37 +05:30
new_namespace_project_merge_request_path(
2015-09-11 14:41:01 +05:30
project.namespace,
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