From 213bd45bb257f0f8fd6108f184b98519ecbf77e7 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Thu, 14 Nov 2024 11:13:01 +0000 Subject: First attempt at properly formatting the resource show page --- app/views/pdfresources/show.html.erb | 56 ++++++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 12 deletions(-) diff --git a/app/views/pdfresources/show.html.erb b/app/views/pdfresources/show.html.erb index 3c4fe66..a4e1d04 100644 --- a/app/views/pdfresources/show.html.erb +++ b/app/views/pdfresources/show.html.erb @@ -1,15 +1,47 @@ -
-
- <% if notice.present? %> -

<%= notice %>

- <% end %> - - <%= render @pdfresource %> - - <%= link_to "Edit this pdfresource", edit_pdfresource_path(@pdfresource), class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> - <%= link_to "Back to pdfresources", pdfresources_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> -
- <%= button_to "Destroy this pdfresource", @pdfresource, method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium" %> +
+
+ <%# Left side - Main thumbnail %> +
+ <%= image_tag @pdfresource.thumbnails.first, + class: "w-full rounded-lg shadow-lg", + alt: @pdfresource.name %> +
+ + <%# Right side - Product details %> +
+

<%= @pdfresource.name %>

+ +
+ Maths + Year 1 (5-6yrs) +
+ +
+

Contains <%= @pdfresource.pdfs.count %> PDF file<%= 's' if @pdfresource.pdfs.count != 1 %>.

+
+ +
+ £<%= number_with_precision(@pdfresource.price || 0.00, precision: 2) %> +
+ +
+

Product summary

+

<%= @pdfresource.description %>

+
+ + <%= button_to "Add to basket", '#', + class: "bg-blue-500 hover:bg-blue-600 text-white font-semibold py-2 px-6 rounded-lg" %> +
+
+ + <%# Bottom thumbnails gallery %> +
+
+ <% @pdfresource.pdf_snapshots.each do |snapshot| %> + <%= image_tag snapshot, + class: "w-full rounded-lg shadow cursor-pointer hover:opacity-75 transition-opacity", + alt: "PDF preview" %> + <% end %>
-- cgit v1.2.3