ManageIQ/manageiq-ui-classic

View on GitHub
app/views/miq_policy/_miq_policy_edit_events.haml

Summary

Maintainability
Test Coverage
- url = url_for_only_path(:action => 'policy_field_changed', :id => (@policy.id || 'new'))
- observe_with_interval = {:interval => '.5', :url => url}.to_json
#policy_details_div
  - if @policy
    #policy_info_div
      = render :partial => "layouts/flash_msg"
      -# Events for this policy
      %h3= _("Event Selection")
      - @edit[:allevents].keys.sort.each do |k|
        .form-horizontal
          .form-group
            %label.col-md-3.control-label
              = h(_(k))
            .col-md-8
              - @edit[:allevents][k].sort_by(&:first).each do |e|
                - checked = @edit[:new][:events].include?(e.last) ? true : false
                = check_box_tag("event_#{e.last}", 'true', checked,
                                :class => "bootstrap-switch-mini",
                                :data => {:on_text => _('Yes'), :off_text => _('No'), :size => 'mini'})
                = h(e.first)
                %br/
                :javascript
                  miqInitBootstrapSwitch("event_#{e.last}", "#{url}")

  = render :partial => '/layouts/edit_form_buttons',
           :locals  => {:action_url => "miq_policy_edit_events", :record_id => @edit[:rec_id], :ajax_buttons => true}