Skip to content

Commit

Permalink
playlists releases on index
Browse files Browse the repository at this point in the history
  • Loading branch information
michelson committed Oct 22, 2024
1 parent 6bc3d4b commit af02869
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 7 additions & 3 deletions app/views/home/_playlist_section.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@
<div class="relative">
<div class="overflow-auto no-scrollbar relative" data-scroll-target="scrollContainer">
<div class="grid grid-cols-1- grid-flow-col grid-rows-1- sm:gap-x-2 md:grid-cols-4- md:gap-y-0- lg:gap-x-8">
<% Playlist.published.latests.where(playlist_type: playlist_type)
.order("editor_choice_position asc, release_date desc, id desc").limit(limit).each do |playlist| %>
<% Playlist.published
.latests
.includes(:releases)
.where(playlist_type: playlist_type)
.order("editor_choice_position asc, release_date desc, id desc").limit(limit).each do |playlist| %>
<div class="w-64 m-4">
<%= link_to playlist_path(playlist) do %>

<%= link_to playlist.releases.any? ? [:albums, playlist.releases.first ] : playlist_path(playlist) do %>
<div class="group group-hover relative">
<div class="relative w-full h-80 bg-default rounded-lg overflow-hidden group-hover:opacity-75 sm:aspect-w-2 sm:aspect-h-1 sm:h-64 lg:aspect-w-1 lg:aspect-h-1">
<%= image_tag(playlist.cover_url,
Expand Down
6 changes: 4 additions & 2 deletions app/views/home/_playlist_section_wide.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
<div class="container mx-auto p-4-">
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4">

<% Playlist.published.where(playlist_type: playlist_type)
<% Playlist.published
.includes(:releases)
.where(playlist_type: playlist_type)
.order("editor_choice_position asc, release_date, id desc").limit(limit).each_with_index do |playlist, index| %>

<div class=" <%= index == 0 ? "col-span-1 sm:col-span-2 sm:row-span-2 bg-brand-600" : "bg-default" %> ">
<%= link_to playlist_path(playlist) do %>
<%= link_to playlist.releases.any? ? album_path(playlist.releases.first) : playlist_path(playlist) do %>
<div class="relative">
<div class="relative w-full h-80 bg-default overflow-hidden sm:aspect-w-2 sm:aspect-h-1 sm:h-64 lg:aspect-w-1 lg:aspect-h-1">
<%= image_tag(playlist.cover_url(:large),
Expand Down

0 comments on commit af02869

Please sign in to comment.