Skip to content

Commit

Permalink
playlists
Browse files Browse the repository at this point in the history
  • Loading branch information
michelson committed Aug 24, 2023
1 parent c416737 commit 99f26d6
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 20 deletions.
7 changes: 4 additions & 3 deletions app/views/playlists/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
<%= form.text_field :title, label: gettext("Playlist title") %>
</div>
</div>

<div class="flex items-center">
<%= form.label "Privacy" %>
</div>

<div class="flex items-start space-x-2 sm:col-span-6">
<div class="flex items-center">
<%= form.label "Privacy" %>
</div>

<div class="flex space-x-2 items-center">
<%= form.radio_button :private, false, label: "Acceso público", hint: "Todo el mundo con el enlace verá este artículo." %>
Expand Down
12 changes: 4 additions & 8 deletions app/views/playlists/_playlist_item.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<h3 class="flex items-center space-x-2 mt-3- text-xl font-extrabold tracking-tight text-slate-900 dark:text-gray-100">
<%= link_to playlist.title, playlist_path(playlist), "data-turbo-frame": "_top" %>
<% if playlist.album? %>
<% if playlist.album? && playlist.release_date.present? %>
<span class="text-xs dark:text-gray-400 font-thin">
<%= gettext("Album") %> <%= l(playlist.release_date, format: :short) %>
</span>
Expand All @@ -26,12 +26,8 @@
>
<% playlist.track_playlists.each do |tp|%>
<li class="py-4 px-2 dark:hover:bg-gray-800">
<a
href="#"
phx-click="change-track"
phx-value-id={track_playlists.track.id}
class="flex items-center space-x-4"
>
<%= link_to player_path(id: tp.track.id, t: true),
class: "flex items-center space-x-4" do %>
<div class="flex-shrink-0">
<%= image_tag(
tp.track.cover_url(:small),
Expand All @@ -55,7 +51,7 @@
</a>
</div>
-->
</a>
<% end %>
</li>
<% end %>
</ul>
Expand Down
6 changes: 3 additions & 3 deletions app/views/playlists/_track_fields.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="nested-fields border-b pt-5"
<div class="nested-fields dark:border-gray-700 border-b pt-5"
data-new-record="<%= form.object.new_record? %>">

<%= form.hidden_field :_destroy %>
Expand All @@ -24,9 +24,9 @@
<div>
<button type="button"
data-action="click->nested-form#remove_association"
class="inline-flex items-center shadow-sm px-2.5 py-0.5 border border-gray-300 text-sm leading-5 font-medium rounded-full text-gray-700 bg-white hover:bg-gray-50"
class="inline-flex items-center shadow-sm p-3 border border-gray-300 dark:border-gray-700 text-sm leading-5 font-medium rounded-full text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-900"
>
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" />
</svg>
</button>
Expand Down
6 changes: 3 additions & 3 deletions app/views/playlists/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@


<nav class="flex space-x-4 mb-10" aria-label="Tabs" data-controller="tabs">
<%= link_to "Add to playlist", new_playlist_path(track_id: @track.id, tab: "add-to-playlist"), class: "bg-brand-100 text-brand-700 px-3 py-2 font-medium text-sm rounded-md" %>
<%= link_to "Create a playlist", new_playlist_path(track_id: @track.id), class: "text-brand-500 hover:text-brand-700 px-3 py-2 font-medium text-sm rounded-md" %>
<%= link_to t("playlist.add_to_playlist"), new_playlist_path(track_id: @track.id, tab: "add-to-playlist"), class: @tab == "add-to-playlist" ? "tab-active" : "tab-default" %>
<%= link_to t("playlist.create"), new_playlist_path(track_id: @track.id), class: @tab != "add-to-playlist" ? "tab-active" : "tab-default" %>
</nav>

<% if @tab == "add-to-playlist" %>
<section id="add-to-tab" class="tab-pane py-4 block">
<h2 class="mx-0 mt-0 mb-4 font-sans text-base font-bold leading-none">
Añadir a la lista
<%= t("playlists.add_to_playlist" )%>
</h2>

<div class="sm:col-span-6">
Expand Down
6 changes: 3 additions & 3 deletions app/views/track_playlists/_track_item.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<%= link_to track_playlist_path(playlist, track_id: track.id),
"data-method": "delete",
"data-turbo-method": "delete",
"data-confirm": "Are you sure?",
"data-confirm": t("sure"),
class: "button" do %>
delete
<%= t("playlist.remove_from_playlist") %>
<% end %>
</div>

Expand All @@ -18,7 +18,7 @@
<%= form_for playlist.track_playlists.new(track: track) do |f|%>
<%= f.hidden_field :track_id %>
<%= f.hidden_field :playlist_id %>
<%= f.submit %>
<%= f.submit(t("playlists.add_to_playlists")) %>
<% end %>
<% end %>
</div>
7 changes: 7 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ en:
by: "By %{name}"
see_everything: See Everything
edit: Edit
delete: Delete
loading: Loading...
repost: Repost
like: Like
likes: Likes
sure: Are you sure?

menu:
music: Music
Expand Down Expand Up @@ -120,6 +122,11 @@ en:
reposts: Reposts
tracks: Tracks

playlists:
add_to_playlists: Add to playlist
create: Create a playlist
remove_from_playlist: Remove from playlist

users:
sign_in: Sign in to your account
register: Register
Expand Down

0 comments on commit 99f26d6

Please sign in to comment.