<%= link_to polymorphic_path(content.class) do %>
<%= content.class.icon %>
<% end %>
share
<%= content.respond_to?(:label) ? content.label : content.name %>
<% categories.each do |category| %>
<%= attribute_category_tab(content, category) %>
<% end %>
<%
markdown = Redcarpet::Markdown.new(
Redcarpet::Render::HTML.new(
with_toc_data: true,
safe_links_only: true,
filter_html: true,
link_attributes: {target: '_blank'}
),
autolink: true,
tables: true,
strikethrough: true,
superscript: true,
underline: true,
highlight: true,
footnotes: true,
)
%>
<% categories.each do |category| %>
_panel" class="row">
<% category.attribute_fields.each do |attribute| %>
<% next if attribute.name.start_with?("private") && @content.user != current_user %>
<% value = nil
if content.respond_to?(attribute.name.to_sym)
value = content.send(attribute.name.to_sym)
else
value = Attribute.where(user: current_user, attribute_field: attribute, entity: content).first
end
%>
<% next if value.blank? %>
<%= attribute.label %>
<% if value.is_a?(ActiveRecord::Associations::CollectionProxy) %>
<% klass = value.first.class || value.build.class %>
<% value.each do |li| %>
<%= link_to li do %>
<%= klass.icon %>
<%= li.name %>
<% end %>
<% end %>
<% elsif attribute.name == 'attribute_category_id' %>
<%= link_to content.attribute_category.label, content.attribute_category if content.attribute_category %>
<% elsif attribute.name == 'universe_id' %>
<%= link_to content.universe.name, content.universe if content.universe %>
<% else %>
<%# TODO: if text is > 240, truncate and add "Read more" link that opens modal %>
140 %> markdownable">
<%= markdown.render(value.is_a?(Attribute) ? value.value : value).html_safe %>
<% end %>
<% end %>
<% end %>
<%= yield :content_show_footer %>
<% if current_user == content.user %>
<%= link_to "Edit this #{content.class.to_s.downcase}", edit_polymorphic_path(@content), class: "btn #{content.class.color}" %>
<% elsif content.user.name.present? %>
<%= content.user.name %> created and maintains this universe on Notebook.ai.
<%= link_to "See more from #{content.user.name}", content.user %>
<%= link_to "Create your own universe.", root_url %>
<% end %>