rx/presenters

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

Summary

Maintainability
Test Coverage
<% if comp %>
  <div class='v-menu'
       data-placement="<%= comp.placement %>"
       <%= "data-right-offset=9999" if eq(comp.position, :right) %>>
  <% if comp.label %>
    <div class="mdc-menu-anchor">
      <span class="v-menu-click">
        <%= expand_text(comp.label.text) %>
        <%= erb(:"components/icon", locals: {comp: comp.label.icon}) %>
      </span>
  <% end %>
  <div id="<%= comp.id %>"
       class="mdc-menu mdc-menu-surface
              <%='mdc-menu--open' if comp.open %>"
       <%= 'data-hoist="false"' if !comp.hoisted %>
       style="position: absolute;" tabindex="-1">
    <ul class="mdc-menu__items mdc-list" role="menu" aria-hidden="true">
      <% comp.items.each do |item| %>
        <% unless eq(item.type, :divider) %>
          <li id="<%= item.id %>"
              class="mdc-list-item
                     <%= 'v-menu-item__selected' if item.selected %>
                     <% if item.disabled %>mdc-list-item--disabled<% end %>"
              role="menuitem"
              tabindex="0"
              <%= 'disabled' if item.disabled %>
              <%= erb :"components/event", :locals => {comp: item, events: item.events, parent_id: item.event_parent_id} unless item.disabled %>>
            <a class="v-menu-link"
                             id="<%= item.id %>"
                             href="javascript:void(0)">
            <%= expand_text(item.text) %>
            </a>
            <%= erb(:"components/icon", locals: {comp: item.icon, position: [:right, :center]}) %>
          </li>
        <% else %>
          <li class="mdc-list-divider" role="separator"></li>
        <% end %>
      <% end %>
    </ul>
  </div>
  <% if comp.label %>
    </div>
  <% end %>
  </div>
<% end %>