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

27 lines
678 B
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
module BranchesHelper
2016-08-24 12:49:21 +05:30
def filter_branches_path(options = {})
exist_opts = {
search: params[:search],
sort: params[:sort]
}
options = exist_opts.merge(options)
2017-09-10 17:25:29 +05:30
project_branches_path(@project, @id, options)
2016-08-24 12:49:21 +05:30
end
2014-09-02 18:07:02 +05:30
def can_push_branch?(project, branch_name)
2016-06-22 15:30:34 +05:30
return false unless project.repository.branch_exists?(branch_name)
2015-12-23 02:04:40 +05:30
2016-08-24 12:49:21 +05:30
::Gitlab::UserAccess.new(current_user, project: project).can_push_to_branch?(branch_name)
2014-09-02 18:07:02 +05:30
end
def project_branches
options_for_select(@project.repository.branch_names, @project.default_branch)
end
2017-08-17 22:00:37 +05:30
def protected_branch?(project, branch)
ProtectedBranch.protected?(project, branch.name)
end
2014-09-02 18:07:02 +05:30
end