rx/presenters

View on GitHub
views/mdc/components/number_field.erb

Summary

Maintainability
Test Coverage
<% if comp
     leading_icon = comp.icon && comp.icon.position.select { |p| eq(p, :left) }.any?
     trailing_icon = comp.icon && comp.icon.position.select {|p| eq(p, :right)}.any?
     auto_complete = comp.auto_complete&.to_sym == :off ? 'extra-off' : comp.auto_complete
%>
  <div id="<%= comp.id %>"
       <%= "data-input-tag='#{comp.tag}'" if comp.tag %>
       <%= 'data-dirtyable' if comp.dirtyable %>
       class="v-input v-text-field v-focusable mdc-text-field mdc-text-field--outlined
            <%= 'mdc-text-field--with-leading-icon' if leading_icon %>
            <%= 'mdc-text-field--with-trailing-icon' if trailing_icon %>
            <%= 'mdc-text-field--disabled' if comp.disabled %>"
       style="<%= 'width:100%' if comp.full_width %>">

    <input id="<%= comp.id %>-input"
           name="<%= comp.name %>"
           type="number"
           <%= "min='#{comp.min}'" if comp.min %>
           <%= "max='#{comp.max}'" if comp.max %>
           <%= "step='#{comp.step}'" if comp.step %>
           <%= 'readonly' if comp.readonly %>
           value="<%= comp.value %>"
           class="mdc-text-field__input"
           aria-controls="<%= comp.id %>-input-helper-text"
           <% if comp.disabled %>disabled
           <% end %>
           <%= 'required' if comp.required %>
           <%= "pattern='#{comp.pattern}'" if comp.pattern %>
           autocomplete="<%= auto_complete %>"
           <%= erb :"components/event", :locals => {comp: comp, events: comp.events, parent_id: "#{comp.id}-input"} %>>

    <%= erb :"components/icon", :locals => {comp: comp.icon, class_name: 'mdc-text-field__icon', parent_id: "#{comp.id}-input"} %>
    <%= erb :"components/shared/input_label", :locals => {comp: comp} %>
  </div>
  <%= erb :"components/shared/hint_error_display", :locals => {comp: comp} %>
  <%= erb :"components/tooltip", :locals => {comp: comp.tooltip, parent_id: comp.id} %>
<% end %>