hummingbird-me/hummingbird

View on GitHub
frontend/app/templates/edits.hbs

Summary

Maintainability
Test Coverage
<div class="container">
  <div class="row">
    <div class="col-md-12 edits" style="margin-top: 40px;">
      <div class="panel panel-default">
        <div class="panel-heading">
          Pending Edits
        </div>
        <div class="panel-body">
          {{#if content}}
            <div class="edit-list">
              {{#each model itemController="edit-item" as |edit|}}
                <div class="edit-entry">
                  <span class="edit-entry-left">
                    <span class="edit-type">
                      {{edit.model.objectType}}
                    </span>
                    {{! link to content }}
                    {{#if edit.model.anime}}
                      {{#link-to 'anime' edit.model.item}}
                        {{edit.model.item.displayTitle}}
                      {{/link-to}}
                    {{/if}}
                    {{#if edit.model.manga}}
                      {{#link-to 'manga' edit.model.item}}
                        {{edit.model.item.displayTitle}}
                      {{/link-to}}
                    {{/if}}
                  </span>
                  <span class="edit-entry-right">
                    <span class="edit-entry-user">
                      {{#link-to 'user' edit.model.user}}
                        {{edit.model.user.username}}
                      {{/link-to}}
                    </span>
                    <span class="edit-entry-time">
                      {{time-ago time=edit.model.createdAt}}
                    </span>
                    <span class="edit-entry-actions">
                      <a href="#" {{action 'toggleDiff'}}>
                        <i {{bind-attr class=":fa edit.isDiffShown:fa-arrow-up:fa-arrow-down"}}></i> View
                      </a>
                    </span>
                  </span>
                </div>

                {{#if edit.isDiffShown}}
                  <div class="edit-entry-diff">
                    {{#if edit.outdated}}
                      <div class="alert alert-danger">
                        {{edit.model.item.displayTitle}} has been updated since this edit was created.
                      </div>
                    {{/if}}
                    {{#if edit.model.comment}}
                      <div class="alert alert-info">
                        <h4>{{edit.model.user.username}} left you a comment!</h4>
                        {{edit.model.comment}}
                      </div>
                    {{/if}}
                    <dl>
                      {{#each edit.changes as |change|}}
                        <dt class="diff-type">{{change.[0]}}</dt>
                        <dd class="diff-body">{{change.[1]}}</dd>
                      {{/each}}
                    </dl>
                    <div class="diff-actions">
                      <a class="btn btn-success" {{action "approveEdit"}}>
                        <i class="fa fa-check"></i> Approve
                      </a>
                      <a class="btn btn-danger" {{action "rejectEdit"}}>
                        <i class="fa fa-close"></i> Reject
                      </a>
                    </div>
                  </div>
                {{/if}}
              {{/each}}

              {{#if canLoadMore}}
                {{load-more classNames="light" action="loadNextPage"}}
              {{/if}}
            </div>
          {{else}}
            <p class="edits-none">There aren't any pending anime changes.</p>
          {{/if}}
        </div>
      </div>
    </div>
  </div>
</div>