ManageIQ/manageiq-ui-classic

View on GitHub
app/views/miq_alert_set/_alert_profile_assign.html.haml

Summary

Maintainability
Test Coverage
- url = url_for_only_path(:action => 'alert_profile_assign_changed')
#alert_profile_assign_div
  = render :partial => "layouts/flash_msg"
  %h3
    = _('Assignments')
  .form-horizontal
    .form-group
      %label.col-md-2.control-label
        = _('Based On')
      .col-md-8
        = h(ui_lookup(:model => @alert_profile.mode))
    .form-group
      %label.col-md-2.control-label
        = _('Assign To')
      .col-md-8
        = select_tag('chosen_assign_to',
          options_for_select([["<#{_('Nothing')}>", nil]] + TermOfServiceHelper::ASSIGN_TOS[@alert_profile.mode].map { |k, v| [_(v).to_s, k.to_s] }.sort, @assign[:new][:assign_to]),
          :class => "selectpicker")
        :javascript
          miqInitSelectPicker();
          miqSelectPickerEvent('chosen_assign_to', '#{url}', {beforeSend: true, complete: true})
    - if @assign[:new][:assign_to].to_s.ends_with?("-tags")
      .form-group
        %label.col-md-2.control-label
          = _('Tag Category')
        .col-md-8
          = select_tag('chosen_cat',
            options_for_select([["<Choose>", nil]] + @assign[:cats].invert.sort, @assign[:new][:cat]),
            :class => "selectpicker")
          :javascript
            miqInitSelectPicker();
            miqSelectPickerEvent('chosen_cat', '#{url}', {beforeSend: true, complete: true})
  - if @assign[:obj_tree]
    %hr
    %h3
      = _('Selections')
    - if @assign[:obj_tree]
      = render(:partial => 'shared/tree', :locals => {:tree => @assign[:obj_tree], :name => @assign[:obj_tree].name})

  - if @assign
    - unless @assign[:rec_id]
      %table{:width => "100%"}
        %tr
          %td{:align => 'right'}
            = button_tag(t = _("Add"),
                           :class   => 'btn btn-primary',
                           :alt     => t,
                           :title   => t,
                           :onclick => "miqAjaxButton('#{url_for_only_path(:action => 'edit_assignment',
                                                                 :button => "add")}');")
            = button_tag(t = _("Cancel"),
                           :class   => 'btn btn-default',
                           :alt     => t,
                           :title   => t,
                           :onclick => "miqAjaxButton('#{url_for_only_path(:action => 'edit_assignment',
                                                                 :button => "cancel")}');")
    -    else
      = render :partial => '/layouts/edit_form_buttons',
               :locals  => {:action_url => "edit_assignment", :record_id => @assign[:rec_id], :ajax_buttons => true}