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

23 lines
597 B
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
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 &&
2018-05-09 12:01:36 +05:30
can?(current_user, :create_merge_request_from, 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