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)

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

def create_mr_button?(from = params[:from], to = params[:to], project = @project)
  from.present? &&
    to.present? &&
    from != to &&
    can?(current_user, :create_merge_request_from, project) &&
    project.repository.branch_exists?(from) &&
    project.repository.branch_exists?(to)
end

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


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

def create_mr_path(from = params[:from], to = params[:to], project = @project)
  project_new_merge_request_path(
    project,
    merge_request: {
      source_branch: to,
      target_branch: from
    }
  )
end