Entities
<%# todo aren't document entities precached somewhere on this page? %> <% analysis.document_entities.includes(:entity, entity: [:image_uploads]).order('entity_type asc, relevance desc').each do |entity| %> <% entity_class = content_class_from_name(entity.entity_type) %>
<% if entity.entity && entity.entity.image_uploads.any? %> <%= image_tag entity.entity.image_uploads.sample.src.url(:large), class: 'activator' %> <% else %> <%= image_tag 'card-headers/' + entity_class.name.downcase.pluralize + '.webp', class: 'activator' %> <% end %>
<%= entity_class.icon %> <%= entity.linked_name_if_possible %> more_vert

Relevance score: <%= entity.relevance.present? ? (entity.relevance * 100).round(1) : 'Calculating...' %>%

<%= entity_class.icon %> <%= entity.linked_name_if_possible %> close
Emotional range
    <% [:joy, :sadness, :fear, :disgust, :anger].each do |emotion| %> <% emotion_score = entity.send("#{emotion}_score") %>
  • <%= emotion.to_s.titleize %>: <%= emotion_score.present? ? (100 * emotion_score).round(1) : 'Calculating...' %>
  • <% end %>
  • Overall sentiment: <%= entity.sentiment_label %> (<%= (entity.sentiment_score.present? ? (100 * entity.sentiment_score).round(1) : 'Calculating...') %>)

If you'd like, you can remove this <%= entity_class.name.downcase %> from the analysis.
<%= link_to "Remove this #{entity_class.name}", destroy_entity_document_path(entity), class: "btn #{entity_class.color}" %>

<% if entity.entity_id %> <% linked_entity_class = entity.entity.class %> <%= link_to polymorphic_path(linked_entity_class.name.downcase, id: entity.entity_id), class: 'blue-text' do %> <%= linked_entity_class.icon %> View <% end %> <%= link_to edit_polymorphic_path(linked_entity_class.name.downcase, id: entity.entity_id), class: 'green-text right' do %> <%= linked_entity_class.icon %> Edit <% end %> <% else %> <%= link_to new_polymorphic_path(entity_class, document_entity: entity.id), class: entity_class.color + '-text' do %> add New <%= entity_class.name %> <% end %> <%= link_to '#', class: entity_class.color + '-text right js-link-entity', data: { id: entity.id } do %> link Link existing <% end %> <% end %>
<% end %>
<%= link_to '#', class: 'white-text js-link-entity', data: { id: -1 } do %>
add
Link a missing page
<% end %>
You can click on the picture of any card in this section to view more information about it or remove it.