<%= shared_content.class.icon %>
Share <%= shared_content.name %>
<% if current_user && shared_content.user == current_user %>
To be shared, content must either be public or in a public Universe.
<%= link_to 'https://medium.com/indent-labs/privacy-on-notebook-ai-how-it-works-c23a59faeae2', class: 'blue-text lighten-1', target: '_new' do %>
Learn more about sharing on Notebook.ai.
<% end %>
Changes are saved automatically and can be changed at any time.
<% if ((shared_content.respond_to? :universe) && shared_content.universe.present?) %>
Universe-wide sharing
<%=
react_component("PrivacyToggle", {
content: shared_content.universe.attributes.slice('id', 'name', 'page_type', 'privacy'),
content_icon: Universe.icon,
content_color: Universe.color,
submit_path: polymorphic_path(shared_content.universe),
csrf_token: form_authenticity_token
})
%>
<% end %>
<% if shared_content.respond_to? :privacy %>
Page-specific sharing
<%=
# Big oof here.
content_obj = if shared_content.is_a?(Document)
{
id: shared_content.id,
name: shared_content.title,
page_type: 'Document',
privacy: shared_content.privacy
}
else
shared_content.attributes.slice('id', 'name', 'page_type', 'privacy')
end
react_component("PrivacyToggle", {
content: content_obj,
content_icon: shared_content.class.icon,
content_color: shared_content.class.color,
submit_path: polymorphic_path(shared_content),
csrf_token: form_authenticity_token
})
%>
<% end %>
<% if shared_content.is_a?(Universe) %>
Sharing this universe will allow all pages within it to also be viewed.
If you'd like to share specific pages, you should share those pages directly instead.
<% end %>
<%= link_to [
'http://twitter.com/share?',
'url=' + CGI.escape(send("#{shared_content.class.name.downcase}_url", shared_content)),
'&text=' + CGI.escape("I'm using Notebook.ai to create fictional worlds! You can see my #{shared_content.class.name.downcase} #{shared_content.name} at this link:")
].join, target: '_new' do %>
Share to Twitter
<% end %>
<% else %>
This <%= shared_content.class.to_s.downcase %> is being shared on Notebook.ai by <%= link_to shared_content.user.name, shared_content.user %>.
<% end %>