ManageIQ/manageiq-ui-classic

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

Summary

Maintainability
Test Coverage
#form_widgets_div
  - edit = @in_a_form ? @edit : @sb
  %h3
    = _('Sample Dashboard')
  - if @in_a_form
    - combo_url = "/report/db_form_field_changed/#{@dashboard.id || 'new'}"
    #form-group
      = select_tag('widget',
          options_for_select(@widgets_options, @edit[:new][:widget].to_s),
          :class => "selectpicker")
  .row#modules
    .col-md-6#col1{:class => @in_a_form ? 'db_widgets_target' : ''}
      - edit[:new][:col1].each do |w|
        - widget = MiqWidget.find_by_id(w)
        - if widget && widget.enabled
          = render :partial => 'db_widget', :locals => {:widget => widget}
    .col-md-6#col2{:class => @in_a_form ? 'db_widgets_target' : ''}
      - edit[:new][:col2].each do |w|
        - widget = MiqWidget.find_by_id(w)
        - if widget && widget.enabled
          = render :partial => 'db_widget', :locals => {:widget => widget}

:javascript
  miqInitSelectPicker();
  miqSelectPickerEvent("widget", "#{combo_url}")