+ <%= simple_format share.message %> ++ + <%= render partial: 'share_comments/form', locals: { share: share } %> +
+ +
diff --git a/app/controllers/content_page_shares_controller.rb b/app/controllers/content_page_shares_controller.rb index 61f905fb..31265662 100644 --- a/app/controllers/content_page_shares_controller.rb +++ b/app/controllers/content_page_shares_controller.rb @@ -31,7 +31,7 @@ class ContentPageSharesController < ApplicationController if @share.save redirect_to [@share.user, @share], notice: 'Content page share was successfully created.' else - render :new + raise @share.errors.inspect end end diff --git a/app/models/content_page_share.rb b/app/models/content_page_share.rb index 7d97c56b..d6e3f2e3 100644 --- a/app/models/content_page_share.rb +++ b/app/models/content_page_share.rb @@ -1,7 +1,7 @@ class ContentPageShare < ApplicationRecord belongs_to :user - belongs_to :content_page, polymorphic: true - belongs_to :secondary_content_page, polymorphic: true + belongs_to :content_page, polymorphic: true, optional: true + belongs_to :secondary_content_page, polymorphic: true, optional: true has_many :share_comments, dependent: :destroy diff --git a/app/views/admin/reported_shares.html.erb b/app/views/admin/reported_shares.html.erb index 07520580..2a8ac7de 100644 --- a/app/views/admin/reported_shares.html.erb +++ b/app/views/admin/reported_shares.html.erb @@ -1,5 +1,15 @@ <% @feed.each do |share| %> - <%= render partial: 'content_page_shares/stream_page_share', locals: { share: share, content: share.content_page } %> + <% if Rails.application.config.content_types[:all].map(&:name).include?(share.content_page_type) %> + <%= render partial: 'content_page_shares/stream_page_share', locals: { share: share, content: share.content_page } %> + <% elsif share.content_page_type == Thredded::Topic.name %> + <%= render partial: 'content_page_shares/stream_discussion', locals: { share: share, content: share.content_page } %> + <% elsif share.content_page_type == PageCollection.name %> + <%= render partial: 'content_page_shares/stream_page_collection', locals: { share: share, content: share.content_page } %> + <% elsif share.content_page_type == Document.name %> + <%= render partial: 'content_page_shares/stream_document_share', locals: { share: share, content: share.content_page } %> + <% else %> + Error loading stream item + <% end %>
ID: <%= share.id %>diff --git a/app/views/content_page_shares/_stream_document_share.html.erb b/app/views/content_page_shares/_stream_document_share.html.erb new file mode 100644 index 00000000..e6147d2c --- /dev/null +++ b/app/views/content_page_shares/_stream_document_share.html.erb @@ -0,0 +1,69 @@ +
+ <%= simple_format share.message %> ++ + <%= render partial: 'share_comments/form', locals: { share: share } %> +