aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-11-13 10:07:50 +0000
committerMatthew Lemon <y@yulqen.org>2024-11-13 10:07:50 +0000
commit018affc145e0b3c823e3e7dcaaada39858f5c8b3 (patch)
tree5b4c0d955a9d4cdb3001079004fa56b25887ac87
parent9442d56c5b4a9dc8b5111bb84ee0d24bcfc571af (diff)
Very ghetto resource featured card layout
-rw-r--r--app/views/layouts/_navbar.html.erb3
-rw-r--r--app/views/pdfresources/_pdfresource.html.erb29
-rw-r--r--app/views/pdfresources/index.html.erb23
3 files changed, 29 insertions, 26 deletions
diff --git a/app/views/layouts/_navbar.html.erb b/app/views/layouts/_navbar.html.erb
index 7a50848..0bc947a 100644
--- a/app/views/layouts/_navbar.html.erb
+++ b/app/views/layouts/_navbar.html.erb
@@ -20,6 +20,9 @@
<li>
<a href="#" class="block py-2 px-3 rounde">Contact</a>
</li>
+ <li>
+ <%= link_to "Log out", Current.session, class: "block py-2 px-3", data: { turbo_method: :delete }%>
+ </li>
</ul>
</div>
</div>
diff --git a/app/views/pdfresources/_pdfresource.html.erb b/app/views/pdfresources/_pdfresource.html.erb
index d947dd1..2e0d86c 100644
--- a/app/views/pdfresources/_pdfresource.html.erb
+++ b/app/views/pdfresources/_pdfresource.html.erb
@@ -1,7 +1,16 @@
-<div id="<%= dom_id pdfresource %>">
+<div id="<%= dom_id pdfresource %>" class="w-[400px] p-3 border border-gray-500 bg-pink-300">
<p class="my-5">
- <strong class="block font-medium mb-1">Name:</strong>
- <%= pdfresource.name %>
+ <div>
+ <%= image_tag url_for(pdfresource.thumbnails.first), class: "object-cover"%>
+ </div>
+ </p>
+
+ <p class="my-5">
+ <strong class="block font-bold mb-1"><%= pdfresource.name %></strong>
+ </p>
+
+ <p class="my-5">
+ <%= pdfresource.card_description %>
</p>
<p class="my-5">
@@ -16,12 +25,6 @@
<% end %>
</p>
- <p class="my-5">
- <strong class="block font-medium mb-1">Thumbnails:</strong>
- <% pdfresource.thumbnails.each do |thumbnail| %>
- <div><%= link_to thumbnail.filename, thumbnail %></div>
- <% end %>
- </p>
<p class="my-5">
<strong class="block font-medium mb-1">Price:</strong>
@@ -48,9 +51,7 @@
<%= pdfresource.description %>
</p>
- <p class="my-5">
- <strong class="block font-medium mb-1">Card description:</strong>
- <%= pdfresource.card_description %>
+ <p>
+ <%= link_to "Show this pdfresource", pdfresource, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
</p>
-
-</div>
+</div> \ No newline at end of file
diff --git a/app/views/pdfresources/index.html.erb b/app/views/pdfresources/index.html.erb
index 5da2312..309dcdd 100644
--- a/app/views/pdfresources/index.html.erb
+++ b/app/views/pdfresources/index.html.erb
@@ -5,19 +5,18 @@
<% content_for :title, "Alphabet Learning - Resources" %>
- <%= link_to "Log out", Current.session, class: "underline my-3", data: { turbo_method: :delete }%>
-
- <div class="flex justify-between items-center">
- <h1 class="font-bold text-4xl">Resources</h1>
- <%= link_to "Add new resource", new_pdfresource_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %>
+ <div class="text-center">
+ <h1 class="font-bold text-4xl m-12">Featured Resources</h1>
</div>
-
- <div id="pdfresources" class="min-w-full">
- <% @pdfresources.each do |pdfresource| %>
- <%= render pdfresource %>
- <p>
- <%= link_to "Show this pdfresource", pdfresource, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
- </p>
+
+ <div id="pdfresources" class="flex flex-wrap space-x-2 justify-between">
+ <% @pdfresources.where("feature_slot < 4").each do |pdfresource| %>
+ <%= render pdfresource %>
<% end %>
</div>
+
+ <% if Current.session.user.is_admin %>
+ <%= link_to "Add new resource", new_pdfresource_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %>
+ <% end %>
+
</div>