rx/presenters

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

Summary

Maintainability
Test Coverage
<%
  horizontal = eq(comp.orientation, :horizontal)
%>
<div class="v-errors">
  <ul id="<%= comp.id %>"
      <% if comp.tag %>
      data-input-tag="<%= comp.tag %>"
      <% end %>
      class="mdl-stepper v-stepper
            <%= ' mdl-stepper--horizontal' if horizontal %>
            <%= ' mdl-stepper--linear' if comp.linear %>">
    <% for step in comp.steps %>
      <%= erb :"components/stepper/#{step.type}", :locals => {:comp => step, vertical: !horizontal} %>
    <% end %>
  </ul>

  <% if horizontal %>
  <div id="<%= comp.id %>-content">
    <% for step in comp.steps %>
      <div id="<%= step.id %>-content"
           <% if step.tag %>
           data-input-tag="<%= step.tag %>"
           <% end %>
           class="v-content v-step__content v-step__content-<%= step.id %>
            <%= ' is-active' if step.selected %>
            <%= ' v-step--horizontal' if horizontal %>">

        <%= erb :"components/render", :locals => {:components => step.components, :scope => nil} %>

        <% if step.actions&.buttons %>
          <div class="v-step__actions v-step__actions-<%= step.id %>">
            <% step.actions.buttons.each do |button| %>
              <%= erb :"components/button", :locals => {:comp => button,
                                                        data_attributes: "data-stepper-#{button.stepper_type}",
                                                        event_parent_id: "#{step.id}-content"}
              %>
            <% end %>
          </div>
        <% end %>
      </div>
    <% end %>
  </div>
   <% end %>

</div>