Module: CompareHelper

Defined in:
app/helpers/compare_helper.rb

Instance Method Summary collapse

Instance Method Details

#create_mr_button?(from = params[:from], to = params[:to], project = @project) ⇒ Boolean

Returns:

  • (Boolean)

2
3
4
5
6
7
8
9
# File 'app/helpers/compare_helper.rb', line 2

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

#create_mr_path(from = params[:from], to = params[:to], project = @project) ⇒ Object


11
12
13
14
15
16
17
18
19
20
# File 'app/helpers/compare_helper.rb', line 11

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