← back to NationalPaperHangers

views/partials/paper-contributions.ejs

24 lines

<%# Shared "X contributions to paper threads" signal — UX backlog #3, tick 4.
    Renders nothing for studios with 0 contributions. Drop into any
    installer template at a sidebar/stats position.
    Expects: paperContributions in scope. %>
<% if (typeof paperContributions !== 'undefined' && paperContributions && paperContributions.count > 0) { %>
  <h3 style="margin-top:24px">Paper threads</h3>
  <p style="margin:0 0 6px;font-size:14px">
    <strong><%= paperContributions.count %></strong> <%= paperContributions.count === 1 ? 'contribution' : 'contributions' %>
    <% if (paperContributions.helpful > 0) { %>
      <span class="muted"> · <%= paperContributions.helpful %> found helpful</span>
    <% } %>
  </p>
  <% if (paperContributions.recent && paperContributions.recent.length) { %>
    <ul style="list-style:none;padding:0;margin:6px 0 0;font-size:13px">
      <% paperContributions.recent.forEach(function(t){ %>
        <li style="padding:4px 0">
          <a href="/papers/<%= t.slug %>" style="color:inherit"><%= t.brand %> · <%= t.paper_name %></a>
        </li>
      <% }); %>
    </ul>
  <% } %>
  <p class="muted" style="font-size:12px;margin:8px 0 0"><a href="/papers" style="color:inherit">See all paper threads →</a></p>
<% } %>