diff options
author | James Edwards-Jones <jedwardsjones@gitlab.com> | 2017-04-04 02:59:37 +0100 |
---|---|---|
committer | James Edwards-Jones <jedwardsjones@gitlab.com> | 2017-04-04 02:59:37 +0100 |
commit | f9e849c076efb3162a3d951d8aae2e7be3e574f4 (patch) | |
tree | 8593f390302635cdfab2e733b305ee01f59bb885 /app/controllers/projects/settings | |
parent | 3bb3a6886f3b206a2ec089d6b1e8854615daa0b8 (diff) | |
download | gitlab-ce-f9e849c076efb3162a3d951d8aae2e7be3e574f4.tar.gz |
Cleaned up duplication with ProtectedRefAccess concern
Diffstat (limited to 'app/controllers/projects/settings')
-rw-r--r-- | app/controllers/projects/settings/repository_controller.rb | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/app/controllers/projects/settings/repository_controller.rb b/app/controllers/projects/settings/repository_controller.rb index ff818d9e51a..9022cf8f0d8 100644 --- a/app/controllers/projects/settings/repository_controller.rb +++ b/app/controllers/projects/settings/repository_controller.rb @@ -23,19 +23,18 @@ module Projects #TODO: consider protected tags #TODO: Refactor ProtectedBranch::PushAccessLevel so it doesn't mention branches { - push_access_levels: { - roles: ProtectedBranch::PushAccessLevel.human_access_levels.map do |id, text| - { id: id, text: text, before_divider: true } - end - }, - merge_access_levels: { - roles: ProtectedBranch::MergeAccessLevel.human_access_levels.map do |id, text| - { id: id, text: text, before_divider: true } - end - } + push_access_levels: levels_for_dropdown(ProtectedBranch::PushAccessLevel), + merge_access_levels: levels_for_dropdown(ProtectedBranch::MergeAccessLevel) } end + def levels_for_dropdown(access_level_type) + roles = access_level_type.human_access_levels.map do |id, text| + { id: id, text: text, before_divider: true } + end + { roles: roles } + end + def protectable_tags_for_dropdown { open_tags: ProtectableDropdown.new(@project, :tags).hash } end |