From 427716c2fc8b196ea3ee6c653b8ecad2b0f6d8e5 Mon Sep 17 00:00:00 2001 From: drusepth Date: Tue, 14 Jun 2022 14:54:27 -0700 Subject: [PATCH] only try to show view/edit links if viewer is signed in --- app/views/content/list/_cards.html.erb | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/app/views/content/list/_cards.html.erb b/app/views/content/list/_cards.html.erb index 762ded8b..e7a89988 100644 --- a/app/views/content/list/_cards.html.erb +++ b/app/views/content/list/_cards.html.erb @@ -31,20 +31,22 @@ <% end %> -
- <% if current_user.can_update?(content) %> - <%= link_to content.is_a?(ContentPage) ? content.edit_path : edit_polymorphic_path(content), class: 'green-text right', target: content.is_a?(Document) ? '_new' : '_self' do %> - <%= content_type.icon %> - Edit + <% if user_signed_in? %> +
+ <% if current_user.can_update?(content) %> + <%= link_to content.is_a?(ContentPage) ? content.edit_path : edit_polymorphic_path(content), class: 'green-text right', target: content.is_a?(Document) ? '_new' : '_self' do %> + <%= content_type.icon %> + Edit + <% end %> <% end %> - <% end %> - <% if current_user.can_read?(content) %> - <%= link_to content.is_a?(ContentPage) ? content.view_path : content, class: 'blue-text text-lighten-1' do %> - <%= content_type.icon %> - View + <% if current_user.can_read?(content) %> + <%= link_to content.is_a?(ContentPage) ? content.view_path : content, class: 'blue-text text-lighten-1' do %> + <%= content_type.icon %> + View + <% end %> <% end %> - <% end %> -
+
+ <% end %>
<%= content.name.presence || 'Document preview' %>