Module: BranchesHelper
- Defined in:
- app/helpers/branches_helper.rb
Instance Method Summary collapse
- #access_levels_data(access_levels) ⇒ Object
- #project_branches ⇒ Object
- #protected_branch?(project, branch) ⇒ Boolean
Instance Method Details
#access_levels_data(access_levels) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/helpers/branches_helper.rb', line 12 def access_levels_data(access_levels) return [] unless access_levels access_levels.map do |level| if level.type == :deploy_key { id: level.id, type: level.type, deploy_key_id: level.deploy_key_id } else { id: level.id, type: :role, access_level: level.access_level } end end end |
#project_branches ⇒ Object
4 5 6 |
# File 'app/helpers/branches_helper.rb', line 4 def project_branches (@project.repository.branch_names, @project.default_branch) end |
#protected_branch?(project, branch) ⇒ Boolean
8 9 10 |
# File 'app/helpers/branches_helper.rb', line 8 def protected_branch?(project, branch) ProtectedBranch.protected?(project, branch.name) end |