mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
commit
ce31c476c6
@ -6,7 +6,8 @@ class DocumentAuthorizer < ApplicationAuthorizer
|
||||
def readable_by?(user)
|
||||
[
|
||||
resource.user_id == user.id,
|
||||
resource.privacy == 'public'
|
||||
resource.privacy == 'public',
|
||||
resource.universe.present? && resource.universe.privacy == 'public'
|
||||
].any?
|
||||
end
|
||||
|
||||
|
||||
@ -44,9 +44,21 @@
|
||||
<div class="hoverable card <%= shared_content.class.color %> lighten-4">
|
||||
<div class="card-content">
|
||||
<div class="card-title">Page-specific sharing</div>
|
||||
<%=
|
||||
<%=
|
||||
# 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: shared_content.attributes.slice('id', 'name', 'page_type', 'privacy'),
|
||||
content: content_obj,
|
||||
content_icon: shared_content.class.icon,
|
||||
content_color: shared_content.class.color,
|
||||
submit_path: polymorphic_path(shared_content),
|
||||
|
||||
@ -1,9 +1,13 @@
|
||||
<%# Usage: render partial: 'content/display/contributors', locals: { content: content } %>
|
||||
|
||||
<% if content.contributors.any? %>
|
||||
<%
|
||||
raw_model = content.is_a?(Universe) ? content : content.raw_model
|
||||
%>
|
||||
|
||||
<% if raw_model.contributors.any? %>
|
||||
<div id="contributors_panel" class="row panel">
|
||||
<ul class="collection">
|
||||
<% content.contributors.each do |contributor| %>
|
||||
<% raw_model.contributors.each do |contributor| %>
|
||||
<% next if contributor.user.nil? && (current_user != content.user) %>
|
||||
<li class="collection-item avatar">
|
||||
<i class="material-icons circle white-text">person</i>
|
||||
@ -27,6 +31,6 @@
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<%= render partial: 'content/form/contributors/leave', locals: { content: content } %>
|
||||
<%= render partial: 'content/form/contributors/leave', locals: { content: raw_model } %>
|
||||
</div>
|
||||
<% end %>
|
||||
Loading…
Reference in New Issue
Block a user