Skip to content

Commit

Permalink
Merge pull request #368 from blackcandy-org/disable-artist-link
Browse files Browse the repository at this point in the history
Disable artist link in album songs list on native app
  • Loading branch information
aidewoode authored Apr 18, 2024
2 parents 5fe380e + 74e3545 commit 2e756cc
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 8 deletions.
11 changes: 10 additions & 1 deletion app/views/albums/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@
<div>
<div data-test-id='album_song_name'><%= song.name %></div>
<% if @album.artist.various? %>
<%= link_to song.artist.name, artist_path(song.artist), class: "c-list__item__subtext" %>
<% if native_app? %>
<span class='c-list__item__subtext'><%= song.artist.name %></span>
<% else %>
<%= link_to song.artist.name, artist_path(song.artist), class: "c-list__item__subtext" %>
<% end %>
<% end %>
</div>
<div class='u-text-monospace u-mr-narrow'><%= format_duration(song.duration) %></div>
Expand All @@ -71,6 +75,11 @@
<%= icon_tag "more-vertical", size: "small", title: t("label.more") %>
</summary>
<div class='c-dropdown__menu' data-dropdown-target="menu">
<%= link_to(
t("label.go_to_artist"),
artist_path(song.artist),
class: "c-dropdown__item"
) %>
<%= link_to(
t("label.add_to_playlist"),
dialog_playlists_path(song_id: song.id, referer_url: current_url),
Expand Down
11 changes: 10 additions & 1 deletion app/views/playlists/songs/_song.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,23 @@
<div class='o-flex o-flex--justify-between o-flex--align-center'>
<div class='u-mr-narrow'>
<span class='u-mb-tiny u-text-line-clamp-2' data-test-id='playlist_song_name'><%= song.name %></span>
<%= song.artist.name %>
<% if native_app? %>
<span class='c-list__item__subtext'><%= song.artist.name %></span>
<% else %>
<%= link_to song.artist.name, artist_path(song.artist), class: "c-list__item__subtext" %>
<% end %>
</div>
<div class='u-text-monospace u-mr-narrow'><%= format_duration(song.duration) %></div>
</div>
<% end %>
<details class='c-dropdown' data-controller='dropdown' data-test-id='playlist_song_menu'>
<summary class="c-button c-button--icon"><%= icon_tag "more-vertical", size: "small", title: t("label.more") %></summary>
<div class='c-dropdown__menu' data-dropdown-target="menu">
<%= link_to(
t("label.go_to_artist"),
artist_path(song.artist),
class: "c-dropdown__item"
) %>
<%= link_to(
t("label.add_to_playlist"),
dialog_playlists_path(song_id: song.id, referer_url: current_url),
Expand Down
3 changes: 2 additions & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ en:
create_playlist: 'Create Playlist'
edit_playlist: 'Edit Playlist'
no_items: 'No Items'
add_to_playlist: 'Add To Playlist'
add_to_playlist: 'Add to Playlist'
update_profile: 'Update Profile'
manage_users: 'Manage Users'
create_user: 'Create User'
Expand Down Expand Up @@ -55,6 +55,7 @@ en:
close: 'Close'
no_search_results: "No search results for \"%{query}\""
search_results_for: "Search results for \"%{query}\""
go_to_artist: 'Go to Artist'

button:
login: 'Login'
Expand Down
2 changes: 1 addition & 1 deletion test/system/album_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class AlbumSystemTest < ApplicationSystemTestCase

visit album_url(@album)
first(:test_id, "album_song_menu").click
click_on "Add To Playlist"
click_on "Add to Playlist"
find(:test_id, "dialog_playlist", text: playlist_name).click

# assert the song added to the playlist
Expand Down
2 changes: 1 addition & 1 deletion test/system/current_playlist_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class CurrentPlaylistSystemTest < ApplicationSystemTestCase

assert_difference -> { playlist.songs.count } do
first(:test_id, "current_playlist_song_menu").click
click_on "Add To Playlist"
click_on "Add to Playlist"
find(:test_id, "dialog_playlist", text: playlist_name).click
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/system/favorite_playlist_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class FavoritePlaylistSystemTest < ApplicationSystemTestCase

assert_difference -> { playlist.songs.count } do
first(:test_id, "playlist_song_menu").click
click_on "Add To Playlist"
click_on "Add to Playlist"
find(:test_id, "dialog_playlist", text: playlist_name).click
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/system/playlist_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class PlaylistSystemTest < ApplicationSystemTestCase

assert_difference -> { playlist.songs.count } do
first(:test_id, "playlist_song_menu").click
click_on "Add To Playlist"
click_on "Add to Playlist"
find(:test_id, "dialog_playlist", text: playlist_name).click
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/system/songs_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class SongsSystemTest < ApplicationSystemTestCase

assert_difference -> { playlist.songs.count } do
first(:test_id, "song_menu").click
click_on "Add To Playlist"
click_on "Add to Playlist"
find(:test_id, "dialog_playlist", text: playlist_name).click
end
end
Expand Down

0 comments on commit 2e756cc

Please sign in to comment.