From 3237ac8bce17a8208d14bbbe45bb0ff2d5208e9a Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Wed, 12 Jun 2019 01:33:55 -0500 Subject: [PATCH] only show edit doc link if current user can --- app/views/documents/show.html.erb | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/app/views/documents/show.html.erb b/app/views/documents/show.html.erb index f95d05c9..59e9186c 100644 --- a/app/views/documents/show.html.erb +++ b/app/views/documents/show.html.erb @@ -6,18 +6,20 @@
<%= ContentFormatterService.substitute_content_links(@document.body.try(:html_safe) || "", current_user).html_safe %>
-
- <%= link_to edit_document_path(@document), target: '_new' do %> -
-
- - Edit this document - + <% if user_signed_in? && current_user.can_update?(@document) %> +
+ <%= link_to edit_document_path(@document), target: '_new' do %> +
+
+ + Edit this document + +
-
- <% end %> + <% end %> - <%= render partial: 'documents/components/smart_sidebar', locals: { document: @document } %> -
+ <%= render partial: 'documents/components/smart_sidebar', locals: { document: @document } %> +
+ <% end %>
<% end %> \ No newline at end of file