ManageIQ/manageiq-ui-classic

View on GitHub
app/views/chargeback_rate/_cb_tier_edit_values.html.haml

Summary

Maintainability
Test Coverage
- tier = @edit[:new][:tiers][detail_index][row_within_rate]
- detail = @edit[:new][:details][detail_index]
%td
  - tier_val = (tier[:start].to_s.eql? 'Infinity') ? '' : tier[:start]
  = text_field_tag("start_#{detail_index}_#{row_within_rate}", tier_val,
    :maxlength => ViewHelper::MAX_NAME_LEN, :placeholder => _('Infinity'), "data-miq_observe" => {:interval => '.5', :url => url}.to_json)
%td
  - tier_val = (tier[:finish].to_s.eql? 'Infinity') ? '' : tier[:finish]
  = text_field_tag("finish_#{detail_index}_#{row_within_rate}", tier_val,
    :maxlength => ViewHelper::MAX_NAME_LEN, :placeholder => _('Infinity'), "data-miq_observe" => {:interval => '.5', :url => url}.to_json)
%td{:align => 'right'}
  = text_field_tag("fixed_rate_#{detail_index}_#{row_within_rate}", tier[:fixed_rate],
    :maxlength => ViewHelper::MAX_NAME_LEN, 'data-miq_observe' => {:interval => '.5', :url => url}.to_json)
%td{:align => 'right'}
  - if detail['group'] == 'fixed' && (tier[:variable_rate].blank? || tier[:variable_rate].zero?)
    /simplify editor, by disabling variable rate edit for fixed rates (allow edit only when this value already exists)
    = '-'
  - else
    = text_field_tag("variable_rate_#{detail_index}_#{row_within_rate}", tier[:variable_rate],
      :maxlength => ViewHelper::MAX_NAME_LEN, 'data-miq_observe' => {:interval => '.5', :url => url}.to_json)