Skip to content

Commit

Permalink
order by release date
Browse files Browse the repository at this point in the history
  • Loading branch information
michelson committed Jul 1, 2024
1 parent 8948063 commit b13898d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 75 deletions.
74 changes: 0 additions & 74 deletions app/views/embeds/_playlist.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,6 @@
<!-- Profile header -->
<div>

<div class="flex flex-col sm:flex-row mb-6">

<div class="w-1/4 hidden sm:block">
<div class="group relative aspect-w-1 aspect-h-1 rounded-md- bg-gray-100 overflow-hidden">
<%= image_tag @playlist.cover_url(:large),
class: "object-center object-cover group-hover:opacity-75"
%>
</div>
</div>
</div>

<div class="max-w-5xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="-mt-12 sm:-mt-16 sm:flex sm:items-end sm:space-x-5">
<div class="flex">
Expand All @@ -31,41 +20,7 @@

</h1>
</div>
<div class="mt-6 flex flex-col justify-stretch space-y-3 sm:flex-row sm:space-y-0 sm:space-x-4">

<%= render "sharer/share_button", resource: @playlist %>
<%= render "likes/like_button", resource: @playlist, button_class: liked?(@playlist) ? "button-active" : "button" %>

<% if user_signed_in? && @playlist.user_id == current_user.id %>
<%= link_to edit_playlist_path(@playlist), class: "button",
"data-turbo-frame": "modal" do %>
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" viewBox="0 0 20 20" fill="currentColor">
<path d="M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z"></path>
</svg>
<span><%= t("playlists.edit") %></span>
<% end %>


<div data-turbo="true">
<%= turbo_frame_tag "playlist-#{@playlist.id}-delete" do %>
<%= button_to playlist_path(@playlist),
method: :delete,
data: {confirm: t("delete.confirm"), turbo_method: :delete, turbo_confirm: t("delete.confirm")},
class: "button" do %>
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z" clip-rule="evenodd"></path>
</svg>
<span><%= t("playlists.delete") %></span>
<% end %>
<% end %>
</div>

<% end %>


</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -166,34 +121,5 @@

</div>




<div class="mt-6 max-w-5xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="sm:col-span-2">
<!-- comments here -->
<section aria-labelledby="activity-title" class="mt-8 xl:mt-10">
<div>
<div class="divide-y divide-gray-200 dark:divide-gray-800">

<div class="pb-4">
<h2 id="activity-title" class="text-lg font-medium text-gray-900 dark:text-gray-100">
<%= t("profile.comments") %>
</h2>
</div>

<div class="pt-6">
<!-- Activity feed-->
<%= render "comments/comment_list", comments: @playlist.comments.limit(10) %>
<% if user_signed_in? %>
<%= render "comments/form", resource: @playlist, comment: current_user.comments.new(commentable: @playlist) %>
<% end %>
</div>
</div>
</div>
</section>
</div>
</div>

</article>
</main>
2 changes: 1 addition & 1 deletion app/views/home/_playlist_section.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<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).limit(limit).each do |playlist| %>
<% Playlist.published.latests.where(playlist_type: playlist_type).order("release_date desc, id desc").limit(limit).each do |playlist| %>
<div class="w-64 m-4">
<%= link_to playlist_path(playlist) do %>
<div class="group group-hover relative">
Expand Down

0 comments on commit b13898d

Please sign in to comment.