ManageIQ/manageiq-ui-classic

View on GitHub
app/views/miq_ae_class/_copy_objects_form.html.haml

Summary

Maintainability
Test Coverage
- url = url_for_only_path(:action => 'form_copy_objects_field_changed', :id => @edit[:rec_id])
= render :partial => "layouts/flash_msg"
#form_div
  = hidden_div_if(!@edit[:new][:namespace], :id => "ae_tree_select_div") do
    = render(:partial => 'layouts/ae_tree_select', :locals => {:entry_point => "Namespace"})
  %p
  .form-horizontal
    .form-group
      %label.col-md-2.control-label
        = _('From Domain')
      .col-md-8
        %p.form-control-static
          = @edit[:domain_name]
    .form-group
      %label.col-md-2.control-label
        = _('To Domain')
      .col-md-8
        %p.form-control-static
          - if @edit[:domains].length == 1
            = @edit[:domains].first.last
          - else
            = select_tag("domain",
                          options_for_select(Array(@edit[:domains].invert).sort,
                          @edit[:new][:domain]),
                          :class    => "selectpicker",
                          "data-miq_observe" => {:url => url}.to_json)
            :javascript
              miqInitSelectPicker();
              miqSelectPickerEvent("domain", "#{url}")

    - if @edit[:selected_items].length == 1 && @edit[:new][:domain].to_i == @edit[:domain_id]
      .form-group
        %label.col-md-2.control-label
          = _('New Name')
        .col-md-8
          = text_field_tag("new_name", @edit[:new][:new_name],
                            :class => "form-control",
                            "data-miq_observe" => {:interval => '.5', :url => url}.to_json)

    .form-group
      %label.col-md-2.control-label
        = _('Copy to same path')
      .col-md-8
        = check_box_tag("override_source",
                        "1",
                        @edit[:new][:override_source],
                        :id                         => "override_source",
                        "data-miq_observe_checkbox" => {:url => url}.to_json)
    - if %w(MiqAeInstance MiqAeMethod).include?(@edit[:typ].to_s)
      .form-group
        %label.col-md-2.control-label
          = _('Replace items if they already exist?')
        .col-md-8
          = check_box_tag("override_existing",
                         "1",
                         @edit[:new][:override_existing],
                         :id                         => "override_existing",
                         "data-miq_observe_checkbox" => {:url => url}.to_json)
    - unless @edit[:new][:override_source]
      .form-group
        %label.col-md-2.control-label
          = _('Namespace')
        .col-md-8
          .input-group
            = text_field_tag("namespace",
                             @edit[:new][:namespace],
                             "data-miq_observe" => {:interval => '.5', :url => url}.to_json,
                             :class             => 'form-control')
            %span.input-group-btn
              %button.btn.btn-default{"onclick" => "miqShowAE_Tree('namespace'); miqButtons('hide', 'automate');",
                                      "title"   => _('Click to select Provisioning Entry Point')}
                %i.ff.ff-load-balancer
              %button.btn.btn-default{'id'       => 'namespace_remove',
                                      'onclick'  => "miqAjax('#{url_for_only_path(:action => 'ae_tree_select_discard', :typ => 'provision')}');",
                                      'title'    => _('Remove this Namespace'),
                                      'disabled' => @edit[:new][:namespace].nil?}
                %i.pficon.pficon-close
  %p
    %table.table.table-striped.table-bordered
      %thead
        %th #{@edit[:selected_items].count} #{n_('Item', 'Items', @edit[:selected_items].count)} #{_('selected to copy')}
      %tbody
        - @edit[:selected_items].values.each do |item|
          %tr
            %td
              = item