Commit afca4f6a authored by Luke Bennett's avatar Luke Bennett

Move direction select to mirror_repos_form

parent 693b5ea8
- expanded = Rails.env.test? - expanded = Rails.env.test?
- protocols = Gitlab::UrlSanitizer::ALLOWED_SCHEMES.join('|') - protocols = Gitlab::UrlSanitizer::ALLOWED_SCHEMES.join('|')
- can_push = can?(current_user, :admin_remote_mirror, @project)
- can_pull = can?(current_user, :admin_mirror, @project)
- options = []
- options.push([_('Pull'), 'pull']) if can_pull
- options.push([_('Push'), 'push']) if can_push
%section.settings.project-mirror-settings.js-mirror-settings.no-animate{ class: ('expanded' if expanded) } %section.settings.project-mirror-settings.js-mirror-settings.no-animate{ class: ('expanded' if expanded) }
.settings-header .settings-header
...@@ -29,11 +24,7 @@ ...@@ -29,11 +24,7 @@
= render 'projects/mirrors/instructions' = render 'projects/mirrors/instructions'
.form-group = render 'projects/mirrors/mirror_repos_form', f: f
= label_tag :mirror_direction, _('Mirror direction'), class: 'label-light'
= select_tag :mirror_direction, options_for_select(options), class: 'form-control js-mirror-direction', disabled: options.count == 1
= render 'projects/mirrors/mirror_repos_form', can_push: can_push, can_pull: can_pull, f: f
.form-check.append-bottom-10 .form-check.append-bottom-10
= check_box_tag :only_protected_branches, '1', false, class: 'js-mirror-protected form-check-input' = check_box_tag :only_protected_branches, '1', false, class: 'js-mirror-protected form-check-input'
......
- protocols = Gitlab::UrlSanitizer::ALLOWED_SCHEMES.join('|') - protocols = Gitlab::UrlSanitizer::ALLOWED_SCHEMES.join('|')
.form-group
= label_tag :mirror_direction, _('Mirror direction'), class: 'label-light'
= select_tag :mirror_direction, options_for_select([[_('Push'), 'push']]), class: 'form-control js-mirror-direction', disabled: true
= f.fields_for :remote_mirrors, @remote_mirror do |rm_f| = f.fields_for :remote_mirrors, @remote_mirror do |rm_f|
= rm_f.hidden_field :enabled, value: '1' = rm_f.hidden_field :enabled, value: '1'
= rm_f.hidden_field :url, class: 'js-mirror-url-hidden', required: true, pattern: "(#{protocols}):\/\/.+" = rm_f.hidden_field :url, class: 'js-mirror-url-hidden', required: true, pattern: "(#{protocols}):\/\/.+"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment