Skip to content

Commit

Permalink
Merge pull request #1417 from safewlabs/upgrade-rails
Browse files Browse the repository at this point in the history
Add back cache
  • Loading branch information
saurabhbhatia authored Dec 6, 2024
2 parents dcf08b5 + 921b125 commit fbfab55
Showing 1 changed file with 28 additions and 16 deletions.
44 changes: 28 additions & 16 deletions app/views/home/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
<section class="py-4">
<div class="max-w-screen-xl p-4 mx-auto sm:px-6 lg:px-8">
<ul class="flex flex-wrap flex-row justify-center items-center">
<% @genres.each do |genre| %>
<li class="p-3 mx-4 my-2 font-bold text-xl">
<%= link_to genre.name, genres_path(genre.slug), data: { "umami-event": "Home-Genre-Click" },
class: "underline hover:text-cx-purple"
%>
</li>
<% cache @genres, expires_in: 60.seconds do %>
<% @genres.each do |genre| %>
<li class="p-3 mx-4 my-2 font-bold text-xl">
<%= link_to genre.name, genres_path(genre.slug), data: { "umami-event": "Home-Genre-Click" },
class: "underline hover:text-cx-purple"
%>
</li>
<% end %>
<% end %>
</ul>
</div>
Expand All @@ -23,8 +25,10 @@
</h2>
</header>
<ul class="grid gap-4 mt-4 sm:grid-cols-6 lg:grid-cols-4">
<% @recent_products.each do |product| %>
<%= render(Products::CardComponent.new(product: product, number_of_products: 4)) %>
<% cache @recent_products, expires_in: 60.seconds do %>
<% @recent_products.each do |product| %>
<%= render(Products::CardComponent.new(product: product, number_of_products: 4)) %>
<% end %>
<% end %>
</ul>
</div>
Expand All @@ -44,8 +48,10 @@
</h2>
</header>
<ul class="grid gap-4 mt-4 sm:grid-cols-2 lg:grid-cols-4">
<% @stores.each do |store| %>
<%= render(Stores::CardComponent.new(store: store)) %>
<% cache @stores, expires_in: 60.seconds do %>
<% @stores.each do |store| %>
<%= render(Stores::CardComponent.new(store: store)) %>
<% end %>
<% end %>
</ul>
</div>
Expand All @@ -65,8 +71,10 @@
</h2>
</header>
<ul class="grid gap-4 mt-4 sm:grid-cols-2 lg:grid-cols-4">
<% @creator_profiles.each do |creator_profile| %>
<%= render(CreatorProfiles::CardComponent.new(creator_profile: creator_profile)) %>
<% cache @creator_profiles, expires_in: 60.seconds do %>
<% @creator_profiles.each do |creator_profile| %>
<%= render(CreatorProfiles::CardComponent.new(creator_profile: creator_profile)) %>
<% end %>
<% end %>
</ul>
</div>
Expand All @@ -86,8 +94,10 @@
</h2>
</header>
<ul class="grid gap-4 mt-4 sm:grid-cols-2 lg:grid-cols-4">
<% @onboarded_products.each do |product| %>
<%= render(Products::CardComponent.new(product: product, number_of_products: 4)) %>
<% cache @onboarded_products, expires_in: 60.seconds do %>
<% @onboarded_products.each do |product| %>
<%= render(Products::CardComponent.new(product: product, number_of_products: 4)) %>
<% end %>
<% end %>
</ul>
</div>
Expand Down Expand Up @@ -257,8 +267,10 @@
</div>
</div>
<div class="mt-3 grid gap-16 lg:grid-cols-3 lg:gap-x-5 lg:gap-y-12">
<% @posts.each do |post| %>
<%= render(Marketing::PostBlurbComponent.new(post: post)) %>
<% cache @posts, expires_in: 60.seconds do %>
<% @posts.each do |post| %>
<%= render(Marketing::PostBlurbComponent.new(post: post)) %>
<% end %>
<% end %>
</div>
</div>
Expand Down

0 comments on commit fbfab55

Please sign in to comment.