From 3e4a469dcbd4fa16d4c441b3312a793f8ac7cfa1 Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Fri, 20 Sep 2024 15:51:19 -0500 Subject: [PATCH] Duh! We can just do this with CSS --- app/assets/stylesheets/bubbles.css | 14 ++++++++++++++ app/views/bubbles/index.html.erb | 6 ++---- app/views/projects/index.html.erb | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/app/assets/stylesheets/bubbles.css b/app/assets/stylesheets/bubbles.css index c5129a6b9..de5355c49 100644 --- a/app/assets/stylesheets/bubbles.css +++ b/app/assets/stylesheets/bubbles.css @@ -8,6 +8,9 @@ } .windshield { + --column-gap: 1cqi; + --row-gap: 1cqi; + margin-block: clamp(var(--block-space), 3%, calc(var(--block-space) * 2)); > * { @@ -29,6 +32,17 @@ position: relative; transition: all 0.2s ease; + &:nth-child(1) { order: 5; } + &:nth-child(2) { order: 3; } + &:nth-child(3) { order: 3; } + &:nth-child(4) { order: 7; } + &:nth-child(5) { order: 9; } + &:nth-child(6) { order: 5; } + &:nth-child(7) { order: 4; } + &:nth-child(8) { order: 9; } + &:nth-child(9) { order: 3; } + &:nth-child(10) { order: 7; } + .windshield & { animation: float-up-left 400ms normal forwards ease-out; diff --git a/app/views/bubbles/index.html.erb b/app/views/bubbles/index.html.erb index 7f36d4e6b..0721a998d 100644 --- a/app/views/bubbles/index.html.erb +++ b/app/views/bubbles/index.html.erb @@ -27,10 +27,8 @@ <% end %> -
- <% cache([@most_active_bubbles, 'stable_shuffle']) do %> - <%= render @most_active_bubbles.sort_by { |bubble| Digest::MD5.hexdigest("#{bubble.id}#{@most_active_bubbles.cache_key}") } %> - <% end %> +
+ <%= render @most_active_bubbles %>
diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb index 5ae73d9d2..bff0ebb6f 100644 --- a/app/views/projects/index.html.erb +++ b/app/views/projects/index.html.erb @@ -18,7 +18,7 @@ <% @projects.each do |project| %>
  • - <% project.bubbles.left_joins(:comments, :boosts).group(:id).order(Arel.sql("COUNT(comments.id) + COUNT(boosts.id) DESC")).limit(10).shuffle.each do |bubble| %> + <% project.bubbles.left_joins(:comments, :boosts).group(:id).order(Arel.sql("COUNT(comments.id) + COUNT(boosts.id) DESC")).limit(10).each do |bubble| %>