ManageIQ/manageiq-ui-classic

View on GitHub
app/views/ops/_ap_form.html.haml

Summary

Maintainability
Test Coverage
- if x_active_tree == :settings_tree
  - url = url_for_only_path(:action => 'ap_form_field_changed', :id => (@scan.id || "new"))
  #ap_form_div
    .form-horizontal
      = render :partial => "layouts/flash_msg"
      %h3
        = _("Basic Information")
      .form-group
        %label.col-md-2.control-label
          = _("Name")
        .col-md-8
          = text_field_tag("name",
                            @edit[:new][:name].to_s,
                            :maxlength => ViewHelper::MAX_NAME_LEN,
                            :class => "form-control",
                            "data-miq_observe" => {:interval => '.5', :url => url}.to_json)
      - if !params[:add] && params[:add] != "new"
        = javascript_tag(javascript_focus('name'))
      .form-group
        %label.col-md-2.control-label
          = _("Description")
        .col-md-8
          = text_field_tag("description",
                            @edit[:new][:description],
                            :maxlength => ViewHelper::MAX_DESC_LEN,
                            :class => "form-control",
                            "data-miq_observe" => {:interval => '.5', :url => url}.to_json)
      .form-group
        %label.col-md-2.control-label
          = _("Type")
        .col-md-8
          %p.form-control-static
            = h(@edit[:new][:scan_mode])
      - edit ||= false
      - entry = (@sb[:miq_tab].split("_")[0] == "edit" || session[:set_copy] == "copy") ? "edit" : "new"
      #ap_tabs
        %ul.nav.nav-tabs{'role' => 'tablist'}
          - if @edit[:new][:scan_mode] == "Host"
            = miq_tab_header('file', @sb[:ap_active_tab]) do
              = _("File")
            = miq_tab_header('event_log', @sb[:ap_active_tab]) do
              = _("Event Log")
          - else
            = miq_tab_header('category', @sb[:ap_active_tab]) do
              = _("Category")
            = miq_tab_header('file', @sb[:ap_active_tab]) do
              = _("File")
            = miq_tab_header('registry', @sb[:ap_active_tab]) do
              = _("Registry")
            = miq_tab_header('event_log', @sb[:ap_active_tab]) do
              = _("Event Log")
        .tab-content
          - if @edit[:new][:scan_mode] != "Host"
            = miq_tab_content('category', @sb[:ap_active_tab]) do
              = render :partial => "ap_form_set"
          = miq_tab_content('file', @sb[:ap_active_tab]) do
            = render :partial => "ap_form_file", :locals => {:entry => entry, :edit => edit}
          - if @edit[:new][:scan_mode] != "Host"
            = miq_tab_content('registry', @sb[:ap_active_tab]) do
              = render :partial => "ap_form_registry", :locals => {:entry => entry, :edit => edit}
          = miq_tab_content('event_log', @sb[:ap_active_tab]) do
            = render :partial => "ap_form_nteventlog", :locals => {:entry => entry, :edit => edit}
:javascript
  miq_tabs_init('#ap_tabs', '/ops/ap_set_active_tab', {edit_mode: 'true'});