Make filters work in the cards path directly re-add strong markup for collections in custom filter names
This commit is contained in:
@@ -10,4 +10,8 @@ module FiltersHelper
|
||||
name = params[key].is_a?(Array) ? "#{key}[]" : key
|
||||
hidden_field_tag name, value, id: nil
|
||||
end
|
||||
|
||||
def filter_selected_collections_title(user_filtering)
|
||||
user_filtering.selected_collection_titles.collect { tag.strong it }.to_sentence.html_safe
|
||||
end
|
||||
end
|
||||
|
||||
@@ -13,16 +13,18 @@ class User::Filtering
|
||||
@collections ||= user.collections.ordered_by_recently_accessed
|
||||
end
|
||||
|
||||
def collections_title
|
||||
def selected_collection_titles
|
||||
if filter.collections.none?
|
||||
collections.one? ? collections.first.name : "All collections"
|
||||
elsif filter.collections.one?
|
||||
filter.collections.first.name
|
||||
[ collections.one? ? collections.first.name : "All collections" ]
|
||||
else
|
||||
filter.collections.map(&:name).to_sentence
|
||||
filter.collections.map(&:name)
|
||||
end
|
||||
end
|
||||
|
||||
def selected_collections_label
|
||||
selected_collection_titles.to_sentence
|
||||
end
|
||||
|
||||
def tags
|
||||
@tags ||= Tag.all.alphabetically
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<% @page_title = @user_filtering.collections_title %>
|
||||
<% @page_title = @user_filtering.selected_collections_label %>
|
||||
|
||||
<%= render "filters/broadcasts", filter: @filter %>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<%= render "filters/menu/add_card_button", user_filtering: @user_filtering %>
|
||||
|
||||
<h1 class="header__title overflow-ellipsis" style="view-transistion-name: card-collection-title">
|
||||
<%= @user_filtering.collections_title %>
|
||||
<%= @user_filtering.selected_collections_label %>
|
||||
</h1>
|
||||
|
||||
<div class="header__actions header__actions--end">
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
<h1 class="header__title overflow-ellipsis">
|
||||
<div class="overflow-ellipsis">
|
||||
Activity in <%= @user_filtering.collections_title %>
|
||||
Activity in <%= @user_filtering.selected_collections_label %>
|
||||
</div>
|
||||
</h1>
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
type: "search", autocorrect: "off", autocomplete: "off", data: { "1p-ignore": "true", filter_target: "input", action: "input->filter#filter" } %>
|
||||
|
||||
<%= render "filters/menu/header" %>
|
||||
<%= render "filters/menu/custom", user_filtering: user_filtering %>
|
||||
<%= render "filters/menu/collections", user_filtering: user_filtering %>
|
||||
<%= render "filters/menu/tags", user_filtering: user_filtering %>
|
||||
<%= render "filters/menu/users", user_filtering: user_filtering %>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<%= form_with url: user_filtering.self_filter_path, method: :get, class: "display-contents",
|
||||
data: { controller: "form" } do |form| %>
|
||||
<% if user_filtering.collections.any? %>
|
||||
<%= render "filters/menu/custom", user_filtering: user_filtering %>
|
||||
|
||||
<ul class="popup__list">
|
||||
<li class="popup__group-title">Collections</li>
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
<ul class="popup__list">
|
||||
<li class="popup__group-title">Saved filters</li>
|
||||
<%= form_with url: cards_path, method: :get, class: "display-contents",
|
||||
data: { controller: "form" } do |form| %>
|
||||
|
||||
<%= render "filters/menu/custom/create" %>
|
||||
<%= render partial: "filters/menu/custom/filter", collection: user_filtering.filters, as: :filter, locals: { user_filtering: user_filtering } %>
|
||||
</ul>
|
||||
<ul class="popup__list">
|
||||
<li class="popup__group-title">Saved filters</li>
|
||||
|
||||
<%= render "filters/menu/custom/create" %>
|
||||
<%= render partial: "filters/menu/custom/filter", collection: user_filtering.filters, as: :filter, locals: { user_filtering: user_filtering } %>
|
||||
</ul>
|
||||
|
||||
<% end %>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<li class="popup__group gap-half overflow-ellipsis" data-navigable-list-target="item" data-filter-target="item">
|
||||
<%= link_to url_for(expand_all: true), class: "btn popup__new popup__item" do %>
|
||||
<%= link_to cards_path(expand_all: true), class: "btn popup__new popup__item" do %>
|
||||
<%= icon_tag "bookmark" %>
|
||||
<div class="flex flex-column txt-tight-lines min-width txt-small">
|
||||
<strong class="overflow-ellipsis">Create a new filter</strong>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<li class="popup__group gap-half overflow-ellipsis" data-filter-target="item" data-navigable-list-target="item">
|
||||
<%= link_to url_for(filter_id: filter.id), class: "btn popup__new popup__item" do %>
|
||||
<%= link_to cards_path(filter_id: filter.id), class: "btn popup__new popup__item" do %>
|
||||
<%= icon_tag "bookmark" %>
|
||||
<div class="flex flex-column txt-tight-lines min-width txt-small">
|
||||
<span class="overflow-ellipsis"><%= user_filtering.collections_title %></span>
|
||||
<span class="overflow-ellipsis"><%= filter_selected_collections_title(user_filtering) %></span>
|
||||
<span class="overflow-ellipsis"><%= filter.summary %></span>
|
||||
</div>
|
||||
<span class="translucent flex-item-no-shrink flex-item-justify-end"> ›</span>
|
||||
|
||||
Reference in New Issue
Block a user