mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
universe serialization fixes
This commit is contained in:
parent
d321c1acc2
commit
dab47b8e01
@ -29,7 +29,7 @@ class ContentSerializer
|
||||
self.id = content.id
|
||||
self.name = content.name
|
||||
self.user = content.user
|
||||
self.universe = content.universe
|
||||
self.universe = content.is_a?(Universe) ? self : content.universe
|
||||
|
||||
self.raw_model = content
|
||||
|
||||
@ -40,9 +40,9 @@ class ContentSerializer
|
||||
self.data = {
|
||||
name: content.try(:name),
|
||||
description: content.try(:description),
|
||||
universe: content.universe_id.nil? ? nil : {
|
||||
id: content.universe_id,
|
||||
name: content.universe.try(:name)
|
||||
universe: self.universe.nil? ? nil : {
|
||||
id: self.universe.id,
|
||||
name: self.universe.try(:name)
|
||||
},
|
||||
categories: self.categories.map { |category|
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
<div>
|
||||
<ul class="collection">
|
||||
<% content.contributors.each do |contributor| %>
|
||||
<% content.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>
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<% if content.contributors.any? %>
|
||||
<% if content.raw_model.contributors.any? %>
|
||||
<p>
|
||||
The following users are enabled as contributors to this universe.
|
||||
<% if user_signed_in? && content.user == current_user %>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<%# Usage: render partial: 'content/form/contributors/leave', locals: { content: content } %>
|
||||
|
||||
<% if user_signed_in? && content.contributors.pluck(:user_id).include?(current_user.id) %>
|
||||
<% if user_signed_in? && content.raw_model.contributors.pluck(:user_id).include?(current_user.id) %>
|
||||
<p class="grey-text">
|
||||
You are a contributor to this universe. You may dismiss yourself as a contributor at any time, but will need to be reinvited to begin contributing again.
|
||||
You will lose access to all content in this universe unless it is shared publicly, even if you created or edited it previously.
|
||||
@ -12,4 +12,4 @@
|
||||
method: 'delete',
|
||||
data: { confirm: "Are you sure? You will no longer have contributor access to this universe." } %>
|
||||
</p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
<%= render 'attribute_fields/modal', content: @content %>
|
||||
|
||||
<div class="row">
|
||||
<%= form_for @content, multipart: true do |form| %>
|
||||
<div class="col s12 m9">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user