aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/pdfresources/show.html.erb
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-11-14 11:20:00 +0000
committerMatthew Lemon <y@yulqen.org>2024-11-14 11:20:00 +0000
commitc8d449c31b29b281a219512bdd5defd5e5ea20f3 (patch)
tree32f053272d42bdc56c277b400292448509f91345 /app/views/pdfresources/show.html.erb
parent213bd45bb257f0f8fd6108f184b98519ecbf77e7 (diff)
Adds Edit and Delete buttons to the show page for admin
Diffstat (limited to '')
-rw-r--r--app/views/pdfresources/show.html.erb16
1 files changed, 14 insertions, 2 deletions
diff --git a/app/views/pdfresources/show.html.erb b/app/views/pdfresources/show.html.erb
index a4e1d04..525e5dd 100644
--- a/app/views/pdfresources/show.html.erb
+++ b/app/views/pdfresources/show.html.erb
@@ -29,8 +29,20 @@
<p class="text-gray-700"><%= @pdfresource.description %></p>
</div>
- <%= button_to "Add to basket", '#',
- class: "bg-blue-500 hover:bg-blue-600 text-white font-semibold py-2 px-6 rounded-lg" %>
+ <div class="flex gap-4">
+ <%= button_to "Add to basket", '#',
+ class: "bg-blue-500 hover:bg-blue-600 text-white font-semibold py-2 px-6 rounded-lg" %>
+
+ <% if Current.session.user&.is_admin %>
+ <%= link_to "Edit", edit_pdfresource_path(@pdfresource),
+ class: "bg-gray-500 hover:bg-gray-600 text-white font-semibold py-2 px-6 rounded-lg" %>
+
+ <%= button_to "Delete", @pdfresource,
+ method: :delete,
+ class: "bg-red-500 hover:bg-red-600 text-white font-semibold py-2 px-6 rounded-lg",
+ data: { turbo_confirm: "Are you sure you want to delete this resource?" } %>
+ <% end %>
+ </div>
</div>
</div>