hummingbird-me/kitsu-web

View on GitHub
app/templates/components/media/media-related.hbs

Summary

Maintainability
Test Coverage
{{#if shouldRender}}
  <section class="media--related">
    <div class="related-media-panel">
      <h5>{{t "media.show.summary.relationships.header"}}</h5>
      <div class="favorite-media-grid row">
        {{#if getRelatedMediaTask.isRunning}}
          {{! @TODO: Custom Loader }}
          <div class="text-xs-center w-100 m-t-1 m-b-1">
            {{loading-spinner size="large"}}
          </div>
        {{else if getRelatedMediaTask.last.value}}
          {{#each getRelatedMediaTask.last.value as |related|}}
            {{#with related.destination as |media|}}
              <div class="favorite-item col-sm-3">
                {{#media-popover media=media attachment="bottom middle" targetAttachment="top middle"}}
                  <a href={{href-to (concat media.modelType ".show") media.slug}}>
                    {{lazy-image src=(image media.posterImage "small")}}
                  </a>
                {{/media-popover}}
              </div>
            {{/with}}
          {{/each}}
        {{/if}}
      </div>
      {{#if getRelatedMediaTask.last.value}}
        <a class="more-link" href={{href-to (concat media.modelType ".show.franchise")}}>
          {{t "media.show.summary.relationships.more" title=media.computedTitle}}
        </a>
      {{/if}}
    </div>
  </section>
{{/if}}