Refactor repository_storages_options_for_select

This commit is contained in:
Nick Thomas 2018-01-31 17:53:09 +00:00
parent 08e013431a
commit 27863b10d1
No known key found for this signature in database
GPG key ID: 2A313A47AFADACE9
2 changed files with 4 additions and 3 deletions

View file

@ -96,12 +96,12 @@ module ApplicationSettingsHelper
]
end
def repository_storages_options_for_select
def repository_storages_options_for_select(selected)
options = Gitlab.config.repositories.storages.map do |name, storage|
["#{name} - #{storage['path']}", name]
end
options_for_select(options, @application_setting.repository_storages)
options_for_select(options, selected)
end
def sidekiq_queue_options_for_select

View file

@ -537,7 +537,8 @@
.form-group
= f.label :repository_storages, 'Storage paths for new projects', class: 'control-label col-sm-2'
.col-sm-10
= f.select :repository_storages, repository_storages_options_for_select, {include_hidden: false}, multiple: true, class: 'form-control'
= f.select :repository_storages, repository_storages_options_for_select(@application_setting.repository_storages),
{include_hidden: false}, multiple: true, class: 'form-control'
.help-block
Manage repository storage paths. Learn more in the
= succeed "." do