hummingbird-me/kitsu-web

View on GitHub
app/templates/components/groups/dashboard/reports/report-item.hbs

Summary

Maintainability
Test Coverage
<div class="stream-item-wrapper col-sm-12">
  <div class="stream-item--title-block">
    <span class="avatar-block">
      <a href={{href-to "users.index" subject.user}} class="author-avatar">
        {{lazy-image src=(image subject.user.avatar "small")}}
      </a>
    </span>

    <div class="author-info">
        <a href={{href-to "users.index" subject.user}} class="author-name">
          {{subject.user.name}}
        </a>
        <span class="tag tag-default">
          {{subject.content.reason}}
        </span>
        <a href={{href-to subject.naughtyLink subject.naughtyId}} target="_blank">
          <small class="secondary-text">
            {{format-relative subject.createdAt interval=1000}}
          </small>
        </a>
      </div>
  </div>

  <div class="stream-content">
    <span class="stream-content-post">
      <p>
        {{#if subject.explanation}}
          {{subject.explanation}}
        {{else}}
          {{t "groups.reports.no-explanation"}}
        {{/if}}
      </p>

      {{#unless (eq subject.content.status "reported")}}
        <p class="text-xs-center">
          <strong>{{t (concat "groups.reports.status." subject.content.status) user=subject.moderator.name}}</strong>
        </p>
      {{/unless}}
    </span>
  </div>

  <div class="leader-actions">
    {{#if hasMoreReports}}
      <a href="#" class="report-list-toggle" {{action (toggle "showExtraReports" this)}}>
        {{#if showExtraReports}}
          {{t "groups.reports.hide-more" num=others.length}}
        {{else}}
          {{t "groups.reports.show-more" num=others.length}}
        {{/if}}
      </a>

      {{#if showExtraReports}}
        <ul class="toggled-reports">
          {{#each others as |other|}}
            <li>
              <div class="media">
                {{lazy-image src=(image other.subject.user.avatar "small")}}
                <div class="media-body">
                  <h5 class="mt-0">{{other.subject.user.name}}</h5>
                  {{#if other.subject.explanation}}
                    {{other.subject.explanation}}
                  {{else}}
                    {{t "groups.reports.no-explanation"}}
                  {{/if}}
                </div>
              </div>
            </li>
          {{/each}}
        </ul>
      {{/if}}
    {{/if}}

    {{! Actions }}
    <ul>
      {{#unless subject.moderator.id}}
        <li>
          <a href="#" class="action-button" {{action "closeReport"}}>
            {{t "groups.reports.actions.close"}}
          </a>
        </li>
        <li>
          <a href="#" class="action-button" {{action "removeContent"}}>
            {{t "groups.reports.actions.remove"}}
          </a>
        </li>
        <li>
          <a href="#" class="action-button" {{action "escalateReport"}}>
            {{t "groups.reports.actions.escalate"}}
          </a>
        </li>
      {{/unless}}
      <li>
        <a href={{href-to subject.naughtyLink subject.naughtyId}} class="action-button" target="_blank">
          {{t "groups.reports.actions.view"}}
        </a>
      </li>
    </ul>
  </div>
</div>