indentlabs/notebook

View on GitHub
app/views/stream/_share.html.erb

Summary

Maintainability
Test Coverage
<% if share.content_page.present? %>
  <% if Rails.application.config.content_types[:all].map(&:name).include?(share.content_page_type) %>
    <%= render partial: 'content_page_shares/stream_page_share', locals: { share: share, content: share.content_page } %>

  <% elsif share.content_page_type == Thredded::Topic.name %>
    <%= render partial: 'content_page_shares/stream_discussion', locals: { share: share, content: share.content_page } %>

  <% elsif share.content_page_type == PageCollection.name %>

    <% if share.secondary_content_page.present? %>
      <%= render partial: 'content_page_shares/stream_added_to_page_collection', locals: { share: share, content: share.content_page, secondary_content: share.secondary_content_page } %>
    <% else %>
      <%= render partial: 'content_page_shares/stream_new_page_collection', locals: { share: share, content: share.content_page } %>
    <% end %>

  <% elsif share.content_page_type == Document.name %>
    <%= render partial: 'content_page_shares/stream_document_share', locals: { share: share, content: share.content_page } %>

  <% elsif share.content_page_type == Timeline.name %>
    <%= render partial: 'content_page_shares/stream_timeline_share', locals: { share: share, content: share.content_page } %>

  <% else %>
    <strong>Error loading stream item</strong>
  <% end %>

  <br /><br />
  <div class="show-on-small hide-on-med-and-up">
    &nbsp;
    <br /><br />
  </div>
<% end %>