rx/presenters

View on GitHub
views/mdc/components/list/line.erb

Summary

Maintainability
Test Coverage
<%
  require_relative "../drag_and_drop/drag_and_drop"
  single_line = !line.subtitle && !line.body
  primary_text_class = single_line  ? '' : 'mdc-list-item__primary-text'
%>

<% if line.menu %>
  <div class="mdc-menu-anchor">
<% end %>
<li class="v-list-item mdc-list-item
          <%= 'mdc-list-item--selected' if line.selected %>
          <%= 'v-menu-click' if line.menu && line.actions.empty?%>
          <%= 'v-list-item--selectable' if line.selectable %>
          <%= 'v-dnd-draggable' if line.draggable %>"
    id="<%= line.id %>"
    <%= draggable_attributes(line) %>
    <%= drop_zone_attributes(line) %>
    <%= erb :"components/event", :locals => {comp: line, events: line.events, parent_id: line.event_parent_id} %>>
  <%= erb :"components/list/hidden_field", :locals => {:line => line} %>
  <%= erb :"components/list/checkbox", :locals => {:line => line} %>
  <%= erb :"components/list/icon", :locals => {:line => line} %>
  <%= erb :"components/list/avatar", :locals => {:line => line} %>
  <span class="mdc-list-item__text
               <%= 'v-actionable' if line.events %>
               <%= 'v-menu-click' if line.menu && line.actions.any? %>">

    <% if line.text %>
      <span class="<%= primary_text_class %>"><%= expand_text(line.text&.text, markdown: line.text&.markdown) %></span>
    <% end %>

    <% if line.subtitle %>
      <span class="mdc-list-item__secondary-text"><%= expand_text(line.subtitle&.text, markdown: line.subtitle&.markdown) %></span>
    <% end %>

    <% if line.body %>
      <span class="mdc-list-item__secondary-text"><%= expand_text(line.body&.text, markdown: line.body&.markdown) %></span>
    <% end %>
  </span>
  <%= erb :"components/list/actions", :locals => {:line => line} %>
</li>
<% if line.menu %>
  <%= erb :"components/list/menu", :locals => {:comp => line.menu} %>
</div>
<%end%>
<%= erb :"components/tooltip", :locals => {comp: line.tooltip, parent_id: line.id} %>
<%= erb :"components/render", :locals => {:components => line.components, :scope => nil} %>