Skip to content

Commit

Permalink
Fix the modal dialog can not dismiss automatically
Browse files Browse the repository at this point in the history
Because black candy use turbo custom rendering to avoid reloading the permanent aside player element. Which means the content that not in app container won't update in normal web page navigation. So we need to put the dialog inside of the app container to avoid dialog can not dismiss automatically after form submitted in dialog.
  • Loading branch information
aidewoode committed May 21, 2024
1 parent 90788f0 commit a0e358e
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/views/dialog/playlists/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<%# And we need a way to save the referer_url as parmas, %>
<%# so we can redirect to the referer_url later. %>
<%= hidden_field_tag :referer_url, params[:referer_url] if native_app? %>
<%= turbo_frame_tag "turbo-dialog-playlists-page-#{@pagy.page}", class: "c-list", data: {action: "click->dialog#hide"}, target: "_top" do %>
<%= turbo_frame_tag "turbo-dialog-playlists-page-#{@pagy.page}", class: "c-list", target: "_top" do %>
<%= render partial: "dialog/playlists/playlist", collection: @playlists %>

<% if @pagy.next %>
Expand Down
4 changes: 1 addition & 3 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,10 @@
<%= render "shared/mini_player" %>
</footer>
</div>
<%= turbo_frame_tag "turbo-dialog" %>
</div>
</div>
<% end %>

<div id='js-overlay' class='c-overlay c-overlay--fixed c-overlay--blur u-display-none'></div>
<%= turbo_frame_tag "turbo-dialog" %>
<% end %>

<%= render template: "layouts/base" %>
2 changes: 1 addition & 1 deletion test/system/album_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,6 @@ class AlbumSystemTest < ApplicationSystemTestCase
first(:test_id, "album_song_menu").click
click_on "Play Last"

assert_equal all(:test_id, "current_playlist_song_name").last.text, first(:test_id, "album_song_name").text
assert_equal first(:test_id, "album_song_name").text, all(:test_id, "current_playlist_song_name").last.text
end
end
2 changes: 1 addition & 1 deletion test/system/playlist_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,6 @@ class PlaylistSystemTest < ApplicationSystemTestCase
first(:test_id, "playlist_song_menu").click
click_on "Play Last"

assert_equal all(:test_id, "current_playlist_song_name").last.text, playlists(:playlist1).songs.first.name
assert_equal playlists(:playlist1).songs.first.name, all(:test_id, "current_playlist_song_name").last.text
end
end
2 changes: 1 addition & 1 deletion test/system/songs_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@ class SongsSystemTest < ApplicationSystemTestCase

first(:test_id, "song_menu").click
click_on "Play Last"
assert_equal all(:test_id, "current_playlist_song_name").last.text, first(:test_id, "song_name").text
assert_equal first(:test_id, "song_name").text, all(:test_id, "current_playlist_song_name").last.text
end
end

0 comments on commit a0e358e

Please sign in to comment.