rx/presenters

View on GitHub
views/mdc/body/header.erb

Summary

Maintainability
Test Coverage
<%
  placement_classes = []
  placement_classes << 'v-header--fixed mdc-top-app-bar--fixed' if eq(header.placement,:fixed)
  placement_classes << 'v-header--static' if eq(header.placement, :static)
%>
<header class="v-header mdc-top-app-bar <%= placement_classes.join(' ') %> drawer-top-app-bar">
  <div class="mdc-top-app-bar__row">
    <section class="mdc-top-app-bar__section mdc-top-app-bar__section--align-start">
      <% if drawer %>
        <button class="material-icons mdc-top-app-bar__navigation-icon mdc-icon-button">menu</button>
      <% end %>
      <span class="mdc-top-app-bar__title <%= 'v-actionable' if header.title&.events %>"
            <%= erb :"components/event", :locals => {comp: header, events: header.title&.events, parent_id: header.title&.event_parent_id} %>>
        <%= expand_text(header.title&.text, markdown: header.title&.markdown) %>
      </span>
    </section>
    <section class="mdc-top-app-bar__section mdc-top-app-bar__section--align-end" role="toolbar">
      <% if header.nav %>
        <nav class="v-navigation">
          <% header.nav.items.each do |item| %>
            <a id="<%= item.id %>"
               class="mdc-list-item <%= 'mdc-list-item--activated' if item.selected %>"
               href="javascript:void(0)"
               tabindex="0"
               aria-selected="true"
               <%= erb :"components/event", :locals => {comp: item, events: item.events, parent_id: item.event_parent_id} %>>
              <%= erb :"components/icon", :locals => {comp: item.icon, class_name: 'mdc-list-item__graphic'} %>
              <%= item.text %>
            </a>
          <% end %>
        </nav>
      <% end %>
      <% if header.button %>
        <%= erb :"components/button", :locals => {comp: header.button, parent_id: header.id} %>
      <% end %>
    </section>
  </div>
</header>
<% if eq(header.placement, :fixed) %><div class="mdc-top-app-bar--fixed-adjust"></div><% end %>