Skip to content

Commit

Permalink
Remove unnecessary fragment cache
Browse files Browse the repository at this point in the history
  • Loading branch information
aidewoode committed Dec 28, 2023
1 parent e0469c4 commit 4de2b64
Show file tree
Hide file tree
Showing 19 changed files with 34 additions and 38 deletions.
2 changes: 1 addition & 1 deletion app/views/albums/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</div>
<% else %>
<%= turbo_frame_tag "turbo-albums-page-#{@pagy.page}", class: "o-grid o-grid--shelf", target: "_top" do %>
<%= render partial: "albums/album", collection: @albums, cached: true %>
<%= render partial: "albums/album", collection: @albums %>

<% if @pagy.next %>
<%= turbo_frame_tag "turbo-albums-page-#{@pagy.next}", src: pagy_url_for(@pagy, @pagy.next), loading: "lazy", class: "o-grid__item o-grid__item--row u-my-small", data: {controller: "element", action: "turbo:frame-render->element#replaceWithChildren"} do %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
json.array! @current_playlist.songs_with_favorite, partial: "api/v1/songs/song", as: :song, cache: true
json.array! @current_playlist.songs_with_favorite, partial: "api/v1/songs/song", as: :song
Original file line number Diff line number Diff line change
@@ -1 +1 @@
json.array! @songs, partial: "api/v1/songs/song", as: :song, cache: true
json.array! @songs, partial: "api/v1/songs/song", as: :song
Original file line number Diff line number Diff line change
@@ -1 +1 @@
json.array! @current_playlist.songs_with_favorite, partial: "api/v1/songs/song", as: :song, cache: true
json.array! @current_playlist.songs_with_favorite, partial: "api/v1/songs/song", as: :song
2 changes: 1 addition & 1 deletion app/views/artists/_albums.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<% if albums.present? %>
<h2><%= title %></h2>
<div class='o-grid o-grid--shelf u-mb-large'>
<%= render partial: "artists/album", collection: albums, cached: true %>
<%= render partial: "artists/album", collection: albums %>
</div>
<% end %>
2 changes: 1 addition & 1 deletion app/views/artists/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</div>
<% else %>
<%= turbo_frame_tag "turbo-artists-page-#{@pagy.page}", class: "o-grid o-grid--shelf", target: "_top" do %>
<%= render partial: "artists/artist", collection: @artists, cached: true %>
<%= render partial: "artists/artist", collection: @artists %>

<% if @pagy.next %>
<%= turbo_frame_tag "turbo-artists-page-#{@pagy.next}", src: pagy_url_for(@pagy, @pagy.next), loading: "lazy", class: "o-grid__item o-grid__item--row u-my-small", data: {controller: "element", action: "turbo:frame-render->element#replaceWithChildren"} do %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/current_playlist/songs/_list.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<ul class="c-list u-my-tiny" data-controller="playlist-sortable" data-playlist-id='<%= playlist.id %>'>
<%= render partial: "current_playlist/songs/song", collection: songs, locals: {playlist: playlist}, cached: true %>
<%= render partial: "current_playlist/songs/song", collection: songs, locals: {playlist: playlist} %>
</ul>
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 @@ -11,7 +11,7 @@
<%# 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 %>
<%= render partial: "dialog/playlists/playlist", collection: @playlists, cached: true %>
<%= render partial: "dialog/playlists/playlist", collection: @playlists %>

<% if @pagy.next %>
<%= turbo_frame_tag "turbo-dialog-playlists-page-#{@pagy.next}", src: pagy_url_for(@pagy, @pagy.next), loading: "lazy", class: "u-my-small", data: {controller: "element", action: "turbo:frame-render->element#replaceWithChildren"} do %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/home/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
<% if @recently_played_albums.present? %>
<h1><%= t("label.recently_played") %></h1>
<div class='o-grid o-grid--shelf u-mb-large'>
<%= render partial: "albums/album", collection: @recently_played_albums, cached: true %>
<%= render partial: "albums/album", collection: @recently_played_albums %>
</div>
<% end %>

<% if @recently_added_albums.present? %>
<h1><%= t("label.recently_added") %></h1>
<div class='o-grid o-grid--shelf u-mb-large'>
<%= render partial: "albums/album", collection: @recently_added_albums, cached: true %>
<%= render partial: "albums/album", collection: @recently_added_albums %>
</div>
<% end %>
<% else %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/playlists/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<%= turbo_frame_tag "turbo-playlists-page-#{@pagy.page}", class: "o-grid o-grid--list", target: "_top" do %>
<% if @playlists.present? %>
<%= render partial: "playlists/playlist", collection: @playlists, cached: true %>
<%= render partial: "playlists/playlist", collection: @playlists %>
<% end %>

<% if @pagy.next %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/playlists/songs/_list.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%= turbo_frame_tag "#{dom_id(playlist)}-page-#{pagy.page}", class: "c-list", target: "_top", data: {controller: "playlist-sortable", playlist_id: playlist.id} do %>
<%= render partial: "playlists/songs/song", collection: songs, locals: {playlist: playlist}, cached: true %>
<%= render partial: "playlists/songs/song", collection: songs, locals: {playlist: playlist} %>

<% if pagy.next %>
<%= turbo_frame_tag "#{dom_id(playlist)}-page-#{pagy.next}", src: pagy_url_for(pagy, pagy.next), loading: "lazy", class: "u-my-small", data: {controller: "element", action: "turbo:frame-render->element#replaceWithChildren"} do %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/search/albums/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h1><%= t("text.search_results", query: params[:query]) %></h1>
<h2><%= t("label.albums") %></h2>
<div class='o-grid o-grid--shelf u-mb-large'>
<%= render partial: "albums/album", collection: @albums, cached: true %>
<%= render partial: "albums/album", collection: @albums %>
</div>
2 changes: 1 addition & 1 deletion app/views/search/artists/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h1><%= t("text.search_results", query: params[:query]) %></h1>
<h2><%= t("label.artists") %></h2>
<div class='o-grid o-grid--shelf u-mb-large'>
<%= render partial: "artists/artist", collection: @artists, cached: true %>
<%= render partial: "artists/artist", collection: @artists %>
</div>
6 changes: 3 additions & 3 deletions app/views/search/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<% end %>
</div>
<div class='o-grid o-grid--shelf u-mb-large'>
<%= render partial: "albums/album", collection: @albums, cached: true %>
<%= render partial: "albums/album", collection: @albums %>
</div>
<% end %>

Expand All @@ -25,7 +25,7 @@
<% end %>
</div>
<div class='o-grid o-grid--shelf u-mb-large'>
<%= render partial: "artists/artist", collection: @artists, cached: true %>
<%= render partial: "artists/artist", collection: @artists %>
</div>
<% end %>

Expand All @@ -38,7 +38,7 @@
<% end %>
</div>
<div class='o-grid o-grid--list u-mb-wide'>
<%= render partial: "playlists/playlist", collection: @playlists, cached: true %>
<%= render partial: "playlists/playlist", collection: @playlists %>
</div>
<% end %>

Expand Down
2 changes: 1 addition & 1 deletion app/views/search/playlists/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<h2><%= t("label.playlists") %></h2>

<div class='o-grid o-grid--list'>
<%= render partial: "playlists/playlist", collection: @playlists, cached: true %>
<%= render partial: "playlists/playlist", collection: @playlists %>
</div>
2 changes: 1 addition & 1 deletion app/views/search/songs/_table.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
</div>
</div>
<div role='rowgroup'>
<%= render partial: "songs/song", collection: songs, cached: true %>
<%= render partial: "songs/song", collection: songs %>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/songs/_table.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</div>
</div>
<%= turbo_frame_tag "turbo-songs-page-#{pagy.page}", role: "rowgroup", target: "_top" do %>
<%= render partial: "songs/song", collection: songs, cached: true %>
<%= render partial: "songs/song", collection: songs %>

<% if pagy.next %>
<%= turbo_frame_tag "turbo-songs-page-#{pagy.next}", src: pagy_url_for(pagy, pagy.next), loading: "lazy", role: "cell", span: "row", class: "o-flex o-flex--justify-center u-my-small u-border-none", data: {controller: "element", action: "turbo:frame-render->element#replaceWithChildren"} do %>
Expand Down
12 changes: 5 additions & 7 deletions app/views/users/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<% page_title_tag t("label.update_profile") %>

<% cache @user do %>
<div class='o-container o-container--extra-narrow'>
<h2 class='u-mb-0'><%= t("label.update_profile") %></h2>
<hr>
<%= render partial: "users/form", locals: {user: @user} %>
</div>
<% end %>
<div class='o-container o-container--extra-narrow'>
<h2 class='u-mb-0'><%= t("label.update_profile") %></h2>
<hr>
<%= render partial: "users/form", locals: {user: @user} %>
</div>
20 changes: 9 additions & 11 deletions app/views/users/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,15 @@
<% if @users.present? %>
<ul class='c-list c-list--border-none'>
<% @users.each do |user| %>
<% cache user do %>
<li id='<%= dom_id(user) %>' class='c-list__item o-flex o-flex--justify-between o-flex--align-center'>
<%= link_to edit_user_path(user), class: "o-flex o-flex--align-center" do %>
<span class='u-mr-tiny'><%= avatar_tag user %></span>
<%= user.email %>
<% end %>
<%= button_to user_path(user), method: :delete, class: "c-button c-button--icon" do %>
<%= icon_tag "delete", size: "small", title: t("label.delete") %>
<% end %>
</li>
<% end %>
<li id='<%= dom_id(user) %>' class='c-list__item o-flex o-flex--justify-between o-flex--align-center'>
<%= link_to edit_user_path(user), class: "o-flex o-flex--align-center" do %>
<span class='u-mr-tiny'><%= avatar_tag user %></span>
<%= user.email %>
<% end %>
<%= button_to user_path(user), method: :delete, class: "c-button c-button--icon" do %>
<%= icon_tag "delete", size: "small", title: t("label.delete") %>
<% end %>
</li>
<% end %>
</ul>
<% else %>
Expand Down

0 comments on commit 4de2b64

Please sign in to comment.