Merge pull request #1092 from basecamp/all-collections-bug

All collections bug
This commit is contained in:
Jorge Manrubia
2025-09-12 13:53:25 +02:00
committed by GitHub
3 changed files with 1 additions and 104 deletions
@@ -1,52 +0,0 @@
<%= form_with url: cards_path, method: :get, class: "display-contents",
data: { controller: "form" } do |form| %>
<% filter.as_params.except(:collection_ids).each do |key, value| %>
<%= filter_hidden_field_tag key, value %>
<% end %>
<% if Current.user.collections.one? %>
<%= link_to cards_path(filter.as_params.except(:collection_ids)), class: "popup__group", id: "filter-collection-init", data: { filter_target: "item", navigable_list_target: "item" } do %>
<%= tag.div class: "popup__item btn" do %>
<span class="overflow-ellipsis"><%= Current.user.collections.first.name %></span>
<span class="txt-ink translucent flex-item-no-shrink flex-item-justify-end"><span class="txt-x-small txt-uppercase">GO TO</span> </span>
<% end %>
<% end %>
<% elsif Current.user.collections.many? %>
<%= link_to cards_path(filter.as_params.except(:collection_ids)), class: "popup__group", id: "filter-collections-all", data: { filter_target: "item", navigable_list_target: "item" } do %>
<label class="popup__radio btn txt-xx-small flex-item-no-shrink">
<input type="checkbox" <%= "checked" if filter.collection_ids.empty? %>>
<span class="for-screen-reader">
See everything in all collections
</span>
<%= icon_tag "check", size: 18, class: "checked" %>
</label>
<%= tag.div class: "popup__item btn" do %>
<span class="overflow-ellipsis">All collections</span>
<span class="txt-ink translucent flex-item-no-shrink flex-item-justify-end"><span class="txt-x-small txt-uppercase">GO TO</span> </span>
<% end %>
<% end %>
<% Current.user.collections.ordered_by_recently_accessed.each do |collection| %>
<li class="popup__group" data-filter-target="item" data-navigable-list-target="item" id="<%= "filter-collection-#{collection.id}" %>">
<label class="popup__radio btn txt-xx-small flex-item-no-shrink">
<%= form.check_box "collection_ids[]", {
checked: filter.collections.include?(collection),
data: { action: "change->form#submit" },
include_hidden: false,
}, collection.id %>
<span class="for-screen-reader">
Toggle filter for <%= collection.name %>
</span>
<%= icon_tag "check", size: 18, class: "checked" %>
</label>
<%= link_to cards_path(collection_ids: [ collection ]), class: "popup__item btn" do %>
<span class="overflow-ellipsis"><%= collection.name %></span>
<span class="translucent flex-item-no-shrink flex-item-justify-end"> </span>
<% end %>
</li>
<% end %>
<% end %>
<% end %>
@@ -1,51 +0,0 @@
<li class="popup__group-title">Collections</li>
<%= form_with url: cards_path, method: :get, class: "display-contents",
data: { controller: "form" } do |form| %>
<% if Current.user.collections.one? %>
<%= link_to cards_path, class: "popup__group", data: { filter_target: "item", navigable_list_target: "item" } do %>
<%= tag.div class: "popup__item btn" do %>
<span class="overflow-ellipsis"><%= Current.user.collections.first.name %></span>
<span class="txt-ink translucent flex-item-no-shrink flex-item-justify-end"><span class="txt-x-small txt-uppercase">GO TO</span> </span>
<% end %>
<% end %>
<% elsif Current.user.collections.many? %>
<li>
<%= link_to cards_path, class: "popup__group", data: { filter_target: "item", navigable_list_target: "item" } do %>
<label class="btn txt-xx-small flex-item-no-shrink">
<input type="checkbox">
<span class="for-screen-reader">
See everything in all collections
</span>
<%= icon_tag "check", size: 18, class: "checked" %>
</label>
<%= tag.div class: "popup__item btn" do %>
<span class="overflow-ellipsis">All collections</span>
<span class="txt-ink translucent flex-item-no-shrink flex-item-justify-end"><span class="txt-x-small txt-uppercase">GO TO</span> </span>
<% end %>
<% end %>
</li>
<% Current.user.collections.ordered_by_recently_accessed.each do |collection| %>
<li class="popup__group" data-filter-target="item" data-navigable-list-target="item">
<label class="btn txt-xx-small flex-item-no-shrink">
<%= form.check_box "collection_ids[]", {
checked: collection == @collection,
data: { action: "change->form#submit" },
include_hidden: false,
}, collection.id %>
<span class="for-screen-reader">
Toggle filter for <%= collection.name %>
</span>
<%= icon_tag "check", size: 18, class: "checked" %>
</label>
<%= link_to cards_path(collection_ids: [ collection ]), class: "popup__item btn" do %>
<span class="overflow-ellipsis"><%= collection.name %></span>
<span class="translucent flex-item-no-shrink flex-item-justify-end"> </span>
<% end %>
</li>
<% end %>
<% end %>
<% end %>
@@ -1,4 +1,4 @@
<% clear_url_path = user_filtering.self_filter_path(user_filtering.as_params.except(:collection_ids)) %>
<% clear_url_path = user_filtering.self_filter_path(user_filtering.as_params.except(:collection_ids), script_name: request.script_name) %>
<% if Current.user.collections.many? %>
<li class="popup__group" data-filter-target="item" data-navigable-list-target="item" id="filter-collection-all">