support-foo/web

View on GitHub
app/views/conversations/_row.html.erb

Summary

Maintainability
Test Coverage
<a class="conversation conversation-row" href="<%= account_conversation_path(conversation.account, conversation) %>">
  <% if current_page?(list_account_conversations_path(@account)) %>
    <div class="actions">
      <button class="btn btn-default archive" data-account-conversation-path="<%= account_conversation_path(@account, conversation, conversation: { archive: true }) %>">
        <%= t('.archive') %>
      </button>
    </div>
  <% end %>

  <div class="summary">
    <%= avatar_default(conversation.creator_person) %>

    <div class="detail">

      <% unread = conversation.messages.count - conversation.read_receipts.where(person: current_user.person).count %>
      <span class="badge badge-message-count <%= 'badge-message-count-unread' if unread > 0 %>">
        <span class="glyphicon glyphicon-envelope"></span>
        <%= conversation.message_count %>
      </span>

      <div class="timestamp <%= 'badge badge-timestamp-stale' if conversation.stale? %>">
        <%= time_ago_in_words(conversation.last_activity_at) %> <%= t('general.ago') %>
      </div>

      <ul class="participants">
        <% conversation.participants.each do |participant| %>
          <li>
            <%= nickname(participant) %>
          </li>
        <% end %>
      </ul>

      <div class="number">
        #<%= conversation.number %>
      </div>
    </div>

    <div class="title">
      <%= summary(conversation) %>
    </div>

    <div class="tag-label-list">
      <% conversation.tags.each do |tag| %>
        <span class="tag-label">#<%= tag %></span>
      <% end %>
    </div>
  </div>
</a>