ManageIQ/manageiq-ui-classic

View on GitHub
app/views/report/_widget_columns.html.haml

Summary

Maintainability
Test Coverage
- url = url_for_only_path(:action => 'widget_form_field_changed', :id => (@widget.id || "new"))
.form-group
  %label.control-label.col-md-2
    - if @edit[:read_only]
      *
    = _('Column 1')
  .col-md-8
    = select_tag("chosen_pivot1", options_for_select([_(ReportHelper::NOTHING_STRING)] + @pivot.options1, @pivot.by1),
      :multiple             => false,
      :class                => "selectpicker",
      :disabled             => @edit[:read_only])
    :javascript
      miqInitSelectPicker();
      miqSelectPickerEvent('chosen_pivot1', '#{url}', {beforeSend: true})
- if @pivot.by1 != ReportHelper::NOTHING_STRING && @pivot.options2.present?
  .form-group
    %label.control-label.col-md-2
      - if @edit[:read_only]
        *
      = _('Column 2')
    .col-md-8
      = select_tag("chosen_pivot2", options_for_select([_(ReportHelper::NOTHING_STRING)] + @pivot.options2, @pivot.by2),
        :multiple             => false,
        :class                => "selectpicker",
        :disabled             => @edit[:read_only])
      :javascript
        miqInitSelectPicker();
        miqSelectPickerEvent('chosen_pivot2', '#{url}', {beforeSend: true});
  - if @pivot.by2 != ReportHelper::NOTHING_STRING && @pivot.options3.present?
    .form-group
      %label.control-label.col-md-2
        - if @edit[:read_only]
          *
        = _('Column 3')
      .col-md-8
        = select_tag("chosen_pivot3", options_for_select([_(ReportHelper::NOTHING_STRING)] + @pivot.options3, @pivot.by3),
          :multiple             => false,
          :class                => "selectpicker",
          :disabled             => @edit[:read_only])
        :javascript
          miqInitSelectPicker();
          miqSelectPickerEvent('chosen_pivot3', '#{url}', {beforeSend: true});
  - if @pivot.by3 != ReportHelper::NOTHING_STRING && @edit[:new][:pivot].options4.present?
    .form-group
      %label.control-label.col-md-2
        - if @edit[:read_only]
          *
        = _('Column 4')
      .col-md-8
        = select_tag("chosen_pivot4", options_for_select([_(ReportHelper::NOTHING_STRING)] + @pivot.options4, @pivot.by4),
          :multiple             => false,
          :class                => "selectpicker",
          :disabled             => @edit[:read_only],
          "data-miq_sparkle_on" => true)
        :javascript
          miqInitSelectPicker();
          miqSelectPickerEvent("chosen_pivot4", "#{url}");