Commit f7874323 authored by Luke Bennett's avatar Luke Bennett

Move direction select to mirror_repos_form

parent f69f5468
- expanded = Rails.env.test?
- 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) }
.settings-header
......@@ -29,11 +24,7 @@
= render 'projects/mirrors/instructions'
.form-group
= label_tag :mirror_direction, _('Mirror direction'), class: 'label-light'
= select_tag :mirror_direction, options_for_select(options), class: 'form-control js-mirror-direction', count: options.count, disabled: options.count == 1
= render 'projects/mirrors/mirror_repos_form', can_push: can_push, can_pull: can_pull, f: f
= render 'projects/mirrors/mirror_repos_form', f: f
.form-check.append-bottom-10
= check_box_tag :only_protected_branches, '1', false, class: 'js-mirror-protected form-check-input'
......
- 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|
= rm_f.hidden_field :enabled, value: '1'
= rm_f.hidden_field :url, class: 'js-mirror-url-hidden', required: true, pattern: "(#{protocols}):\/\/.+"
......
- import_data = @project.import_data || @project.build_import_data
- is_one_user_option = default_mirror_users.count == 1
- protocols = Gitlab::UrlSanitizer::ALLOWED_SCHEMES.join('|')
- can_push = can?(current_user, :admin_remote_mirror, @project)
- can_pull = can?(current_user, :admin_mirror, @project) && !@project.mirror
- options = []
- options.push([_('Pull'), 'pull']) if can_pull
- options.push([_('Push'), 'push']) if can_push
.form-group
= 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
.js-form-insertion-point
......
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