ManageIQ/manageiq-ui-classic

View on GitHub
app/views/catalog/_st_form.html.haml

Summary

Maintainability
Test Coverage
- url = url_for_only_path(:id => (@edit[:rec_id] || "new"),
  :action => @edit[:new][:service_type] == "composite" ? "st_form_field_changed" : "atomic_form_field_changed")
#form_div
  = render :partial => "layouts/flash_msg"
  -# show form if Catalog bundle is being added or if it's an edit of existing catalog item, else force user to select type
  - if @edit[:new][:service_type] == "atomic" && !@edit[:wf] && !@edit[:new][:st_prov_type]
    .form-horizontal
      .form-group
        %label.col-md-2.control-label= _('Catalog Item Type')
        .col-md-8
          - catalog_item_types = ServiceTemplate.catalog_item_types
          - array = catalog_item_types.collect { |x| [x[1][:description], x[0]] }
          - array.sort_by! { |a| a.first.downcase }
          - disabled_options = catalog_item_types.collect { |x| x[0] unless x[1][:display] }
          = select_tag('st_prov_type',
                       options_for_select(([["<#{_('Choose')}>",nil]]) + array,
                       :selected => '',
                       :disabled => disabled_options),
                       "data-miq_sparkle_on" => true,
                       :class    => "selectpicker")
          :javascript
            miqInitSelectPicker();
            miqSelectPickerEvent('st_prov_type', "#{url}", {beforeSend: true, complete: true})
  - else
    = render :partial => "form"