From cd41220a6e432469c1b328811cf05e1ac59957ed Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Tue, 11 Jun 2019 17:34:18 -0500 Subject: [PATCH] document sharing from documents#show --- app/controllers/documents_controller.rb | 2 +- app/views/documents/show.html.erb | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index b07cd8f9..cc6f956f 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -102,6 +102,6 @@ class DocumentsController < ApplicationController private def document_params - params.require(:document).permit(:title, :body, :deleted_at) + params.require(:document).permit(:title, :body, :deleted_at, :privacy) end end diff --git a/app/views/documents/show.html.erb b/app/views/documents/show.html.erb index 72d3004f..90725ba7 100644 --- a/app/views/documents/show.html.erb +++ b/app/views/documents/show.html.erb @@ -18,6 +18,21 @@ <% end %> + + <% if @document.persisted? %> + <%= link_to '#', class: "halfway-fab waves-effect waves-light share", style: 'width: 100%' do %> +
+
+ share + Share document +
+
+ <% end %> + <% end %> <% end %> + +<% if @document.persisted? %> + <%= render partial: 'content/share', locals: { shared_content: @document } %> +<% end %>