mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
134 lines
5.6 KiB
Plaintext
134 lines
5.6 KiB
Plaintext
<% if @content.present? && @content.respond_to?(:as_jsonld) %>
|
|
<script type="application/ld+json">
|
|
<%= @content.as_jsonld.to_json.html_safe %>
|
|
</script>
|
|
<% end %>
|
|
|
|
<% set_meta_tags title: content.name, description: content.description %>
|
|
<%# TODO: Check if <content type>/_meta exists and render it here if so %>
|
|
|
|
<% content_for :sidebar_top do %>
|
|
<%= render partial: 'cards/serendipitous/content_question', locals: { question: @question, content: @content } %>
|
|
<% end %>
|
|
|
|
<% categories = @content.class.attribute_categories(@content.user) %>
|
|
<div class="row">
|
|
<div class="col s9">
|
|
<div class="hoverable card">
|
|
<div class="card-image">
|
|
<%= render partial: 'content/display/image_card_header' %>
|
|
<%= render partial: 'content/display/floating_action_buttons', locals: { editing: false } %>
|
|
</div>
|
|
|
|
<div class="card-content">
|
|
<% categories.each do |category| %>
|
|
<div id="<%= category.name.gsub("'", '') %>_panel" class="row panel">
|
|
<% if category.name == 'gallery' %>
|
|
<div>
|
|
<%= render partial: 'content/form/images/gallery', locals: { content: content } %>
|
|
</div>
|
|
<% end %>
|
|
<% if category.name == 'changelog' %>
|
|
<div>
|
|
<%= render partial: 'content/display/changelog', locals: { content: content } %>
|
|
</div>
|
|
<% end %>
|
|
<% if category.name == 'contributors' %>
|
|
<div>
|
|
<%= render partial: 'content/display/contributors', locals: { content: content } %>
|
|
</div>
|
|
<% end %>
|
|
<% category.attribute_fields.each do |attribute| %>
|
|
<% if attribute.name.start_with?("private") %>
|
|
<% next unless user_signed_in? && (
|
|
(content.is_a?(Universe) && content.user == current_user) ||
|
|
(content.respond_to?(:universe) && content.universe && content.universe.user == current_user) ||
|
|
(content.respond_to?(:universe) && content.universe.nil? && content.user == current_user)
|
|
)
|
|
%>
|
|
<% end %>
|
|
|
|
<%
|
|
custom_field = false
|
|
value = nil
|
|
if content.respond_to?(attribute.name.to_sym)
|
|
# Native fields with columns on the content table
|
|
value = content.send(attribute.name.to_sym)
|
|
else
|
|
custom_field = true
|
|
value = Attribute.where(user: @content.user, attribute_field: attribute, entity: content).first || ""
|
|
end
|
|
%>
|
|
<% next if value.blank? && !custom_field %>
|
|
|
|
<div class="row">
|
|
<div class="col s3 m3 l3 right-align flow-text grey-text"><%= attribute.label %></div>
|
|
<% if value.is_a?(ActiveRecord::Associations::CollectionProxy) %>
|
|
<% klass = value.first.class || value.build.class %>
|
|
<div class="col s9 m9 l9 flow-text">
|
|
<% value.each do |li| %>
|
|
<div class="chip">
|
|
<%= link_to li do %>
|
|
<span class="<%= klass.color %>-text"><i class="material-icons left"><%= klass.icon %></i></span>
|
|
<%= li.name %>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% elsif attribute.name == 'attribute_category_id' %>
|
|
<div class="col s9 m9 l9 flow-text">
|
|
<%= link_to content.attribute_category.label, content.attribute_category if content.attribute_category %>
|
|
</div>
|
|
<% elsif attribute.name == 'universe_id' %>
|
|
<div class="col s9 m9 l9 flow-text">
|
|
<%= link_to content.universe.name, content.universe if content.universe %>
|
|
</div>
|
|
<% else %>
|
|
<div class="col s9 m9 l9 markdownable">
|
|
<%= simple_format Rails.application.config.markdown.render(value.is_a?(Attribute) ? value.value : value).html_safe %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
|
|
<% if current_user.nil? || current_user.id != @content.user_id && (@content.respond_to?(:universe) && @content.universe && @content.universe.user_id != current_user.id) %>
|
|
<div class="card-action center">
|
|
<p>
|
|
This <%= @content.class.name.downcase %> was created by <%= @content.user.name %> on Notebook.ai<% if @content.is_a?(Universe) && @content.contributors.any? %> with <%= pluralize @content.contributors.count, 'contributor' %><% end %>.
|
|
</p>
|
|
<%= link_to "See more from #{@content.user.name}", @content.user %>
|
|
<%= link_to "Create your own universe", root_url %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col s3">
|
|
<%= render partial: 'content/display/sidelinks' %>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
$(document).ready(function(){
|
|
$('.slider').slider({
|
|
height: 200,
|
|
indicators: false
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<%= render partial: 'content/share', locals: { shared_content: @content} %>
|
|
<%= render partial: 'attribute_fields/modal', locals: { content: @content, safe_mode: true } if user_signed_in? %>
|
|
|
|
<div class="row">
|
|
<% if @content.is_a?(Universe) %>
|
|
<%= render partial: 'content/contexts/universe', locals: { content: @content } %>
|
|
<% else %>
|
|
<%= render partial: "content/contexts/dynamic", locals: { content: @content } %>
|
|
<% end %>
|
|
</div>
|