From 9292aae8fe1876fe98c90ae0216fb4ea8917b38a Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Thu, 14 Nov 2024 17:00:19 +0000 Subject: Tidied up the cards on the index page --- app/views/pdfresources/_form.html.erb | 15 +--- app/views/pdfresources/_pdfresource.html.erb | 101 ++++++++------------------- 2 files changed, 33 insertions(+), 83 deletions(-) diff --git a/app/views/pdfresources/_form.html.erb b/app/views/pdfresources/_form.html.erb index a3922c9..f75f20d 100644 --- a/app/views/pdfresources/_form.html.erb +++ b/app/views/pdfresources/_form.html.erb @@ -80,7 +80,7 @@
<%= form.label :price, class: "font-bold" %> - <%= form.number_field :price, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %> + <%= form.number_field :price, step: "0.01", min: "0", class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>

This is what we will sell it for!

@@ -111,17 +111,8 @@
- <%= form.label :feature_slot, "Feature Position", class: "font-bold" %> - <%= form.select :feature_slot, - options_for_select([ - ["Not Featured", nil], - ["Position 1", 1], - ["Position 2", 2], - ["Position 3", 3] - ], pdfresource.feature_slot), - { include_blank: false }, - class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %> -

Select a position to feature this resource, or "Not Featured" to remove from featured items. Only three resources can be featured at a time.

+ <%= form.label :feature_slot, class: "font-bold" %> + <%= form.number_field :feature_slot, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
diff --git a/app/views/pdfresources/_pdfresource.html.erb b/app/views/pdfresources/_pdfresource.html.erb index 7ce1807..5edbd35 100644 --- a/app/views/pdfresources/_pdfresource.html.erb +++ b/app/views/pdfresources/_pdfresource.html.erb @@ -1,76 +1,35 @@ -
- -
- <%= image_tag url_for(pdfresource.thumbnails.first), class: "w-full h-full object-cover rounded-t-lg" %> -
- -

- <%= link_to pdfresource.name, pdfresource, class: "text-blue-500 font-bold" %> -

- -
- #photography - #travel - #winter -
- -

- <%= pdfresource.card_description %> -

- -

- Stripe product: - <%= pdfresource.stripe_product_id %> -

- -
- PDFs: - <% pdfresource.pdfs.each do |pdf| %> -
<%= link_to pdf.filename, pdf %>
- <% end %> +
+ <%# Image section %> +
+ <%= image_tag url_for(pdfresource.thumbnails.first), class: "w-full h-full object-cover" %>
-
- Snapshots: - <% pdfresource.pdf_snapshots.each do |image| %> -
- <%= image_tag url_for(image) %> - <%= link_to image.filename, image %> + <%# Content section %> +
+ <%# Title %> +

+ <%= link_to pdfresource.name, pdfresource %> +

+ + <%# Tags/badges %> +
+ Reception (4-5yrs) + EYs Maths + Feature slot: <%= pdfresource.feature_slot %> +
+ + <%# Description %> +

+ <%= pdfresource.card_description %> +

+ + <%# Footer with price and add to cart %> +
+
+ £<%= number_with_precision(pdfresource.price, precision: 2) %> + <%= pdfresource.credits %> credits
- <% end %> + <%= button_to "Add to basket", "#", class: "bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded" %> +
- -

- Resource type: - <%= pdfresource.resource_type&.name if pdfresource.respond_to?(:resource_type) %> -

- -

- Price: - <%= pdfresource.price %> -

- -

- Age range: - <%= pdfresource.age_range %> -

- -

- Curriculum: - <%= pdfresource.curriculum %> -

- -

- Feature slot: - <%= pdfresource.feature_slot %> -

- -

- Description: - <%= pdfresource.description %> -

- -

- <%= link_to "Show this pdfresource", pdfresource, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> -

\ No newline at end of file -- cgit v1.2.3