<%= render partial: 'content/contexts/relation', locals: { content_type: Character, content: content, relation_class: Birthing, relation_class_id: :birthplace_id, relation_text: " born here" # 5 characters born here } %> <%= render partial: 'content/contexts/relation', locals: { content_type: Creature, content: content, relation_class: Wildlifeship, relation_class_id: :habitat_id, relation_text: " native here" # 5 creatures native here } %> <%= render partial: 'content/contexts/relation', locals: { content_type: Religion, content: content, relation_class: ReligiousLocationship, relation_class_id: :practicing_location, relation_text: " practiced here" } %> <%= render partial: 'content/contexts/relation', locals: { content_type: Group, content: content, relation_class: Headquartership, relation_class_id: :headquarter_id, relation_text: " headquarters here" } %> <%= render partial: 'content/contexts/relation', locals: { content_type: Group, content: content, relation_class: Officeship, relation_class_id: :office_id, relation_text: " office(s) here" } %> <%= render partial: 'content/contexts/relation', locals: { content_type: Group, content: content, relation_class: GroupLocationship, relation_class_id: :location_id, relation_text: " here" } %> <%= render partial: 'content/contexts/relation', locals: { content_type: Flora, content: content, relation_class: FloraLocation, relation_class_id: :location_id, relation_text: ' found here' } %> <% scenes = SceneLocationship.where(scene_location_id: content.id).map(&:scene).compact.select { |content| content && content.readable_by?(current_user || User.new) } %> <% if scenes.any? %>
<%= render partial: 'content/cards/in_universe_content_list', locals: { content_type: :scene, content_list: scenes, card_title: "#{pluralize(scenes.count, 'scene')} happens here" } %>
<% end %> <% @references.each do |content_type, relations| %> <% next unless relations.any? %> <% card_title = if relations.count == 1 if relations.first.first.include? '' relations.first.first else [ relations.first.first, ' ', pluralize(relations.count, "#{content_type.to_s.singularize}") ].join end else [ 'Related to ', pluralize(relations.count, "other #{content_type.to_s.singularize}") ].join end %>
<%= render partial: 'content/cards/content_relation_list', locals: { content_type: content_type, relations: relations, card_title: card_title } %>
<% end %>