-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #123 - Avoid caching song_id form parameter
Restructure the add to playlist form so that instead of a list of buttons, each generating a form, we wrap the playlist buttons in a single form and each playlist button changes the form action when clicked to the proper playlist url. This allows caching each button and fixes the bug where the song_id was cached with the html for each button.
- Loading branch information
1 parent
be121c3
commit 86fe009
Showing
2 changed files
with
17 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
<%= button_to playlist_songs_path(playlist, song_id: params[:song_id]), method: :post, class: 'c-list__item u-cursor-pointer', form: { 'data-turbo-frame': 'turbo-playlist', 'data-test-id': 'dialog_playlist' } do %> | ||
<button type="submit" class='c-list__item u-cursor-pointer' | ||
formaction="<%= playlist_songs_path(playlist) %>" data-test-id="dialog_playlist"> | ||
<%= playlist.name %> | ||
<% end %> | ||
</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters