Read about our upcoming Code of Conduct on this issue

branches_helper.rb 632 Bytes
Newer Older
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
1
module BranchesHelper
2
3
4
5
6
7
8
9
  def filter_branches_path(options = {})
    exist_opts = {
      search: params[:search],
      sort: params[:sort]
    }

    options = exist_opts.merge(options)

10
    project_branches_path(@project, @id, options)
11
12
  end

13
14
15
  def project_branches
    options_for_select(@project.repository.branch_names, @project.default_branch)
  end
16
17
18
19

  def protected_branch?(project, branch)
    ProtectedBranch.protected?(project, branch.name)
  end
20
21
22
23
24
25
26
27

  def diverging_count_label(count)
    if count >= Repository::MAX_DIVERGING_COUNT
      "#{Repository::MAX_DIVERGING_COUNT - 1}+"
    else
      count.to_s
    end
  end
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
28
end