ManageIQ/manageiq-ui-classic

View on GitHub
app/views/ops/_classification_entry.html.haml

Summary

Maintainability
Test Coverage
= entry.inspect
- if edit
  - url = url_for_only_path(:action => "ce_accept", :id => "accept")
  - if entry == "new"
    %tr{:class => cycle('row0', 'row1')}
      %td
        = text_field("entry", "name", :maxlength => ViewHelper::MAX_NAME_LEN, :style => "width: 100%;")
      %td
        = text_field("entry", "description", :maxlength => ViewHelper::MAX_DESC_LEN, :style => "width: 100%;")
      %td.action-cell
        %button.btn.btn-default.btn-block.btn-sm{:title => _("Add this entry"),
          "data-submit"         => 'classification_entries_div',
          "data-miq_sparkle_on" => true,
          :remote               => true,
          "data-method"         => :post,
          'data-click_url'      => {:url => "#{url}"}.to_json}
          = _("Add")
  - else
    %tr{:class => cycle('row0', 'row1'), :id => "#{entry.id}_tr"}
      %td
        = text_field("entry", "name",
          :maxlength => ViewHelper::MAX_NAME_LEN,
          "value"    => entry.name,
          :style     => "width: 100%;")
      %td
        = text_field("entry", "description",
          :maxlength => ViewHelper::MAX_DESC_LEN,
          "value"    => entry.description,
          :style     => "width: 100%;")
      %td.action-cell
        %button.btn.btn-default.btn-block.btn-sm{:title => _("Update this entry"),
          "data-submit"         => 'classification_entries_div',
          "data-miq_sparkle_on" => true,
          :remote               => true,
          "data-method"         => :post,
          'data-click_url'      => {:url => "#{url}"}.to_json}
          = _("Save")
- else
  - if entry == "new"
    %tr{:class => cycle('row0', 'row1'), :onclick => remote_function(:url => {:action => 'ce_select', :id => 'new'}), :title => _("Click to add a new entry")}
      %td
        = _("<New Entry>")
      %td= _("<Click on this row to create a new entry>")
      %td.action-cell
        %button.btn.btn-default.btn-block.btn-sm
          = _("Add")
  - else
    %tr{:class => cycle('row0', 'row1'), :id => "#{entry.id}_tr"}
      %td{:onclick => remote_function(:url => {:action => 'ce_select', :id => entry.id, :field => "name"}), :title => _("Click to update this entry")}
        = entry.name
      %td{:onclick => remote_function(:url => {:action => 'ce_select', :id => entry.id, :field => "description"}), :title => _("Click to update this entry")}
        = entry.description
      %td.action-cell
        %button.btn.btn-default.btn-block.btn-sm{:onclick => remote_function(:url => {:action => 'ce_delete',
                                                    :id     => entry.id},
                                           :confirm => _("Deleting the '%{entry_name}' entry will also unassign it from all items, are you sure?") % {:entry_name => entry.name}),
                                           :title => _("Click to delete this entry")}
          = _("Delete")