Restore add card button in the timeline
It will add to the first selected collection, or to the first one in the menu if no collection selected
This commit is contained in:
@@ -83,6 +83,11 @@ class User::Filtering
|
||||
end
|
||||
end
|
||||
|
||||
def single_collection_or_first
|
||||
# Default to the first selected or, when no selection, to the first one
|
||||
filter.collections.first || collections.first
|
||||
end
|
||||
|
||||
def cache_key
|
||||
ActiveSupport::Cache.expand_cache_key([ user, filter, expanded? ], "user-filtering")
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<% content_for :header do %>
|
||||
<%= render "filters/menu", user_filtering: @user_filtering %>
|
||||
<%= render "filters/menu/add_card_button", user_filtering: @user_filtering %>
|
||||
<%= render "events/index/add_card_button", user_filtering: @user_filtering %>
|
||||
|
||||
<h1 class="header__title overflow-ellipsis">
|
||||
<div class="overflow-ellipsis">
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<div class="header__actions header__actions--start">
|
||||
<% if collection = user_filtering.single_collection %>
|
||||
<% if collection = user_filtering.single_collection_or_first %>
|
||||
<%= button_to collection_cards_path(collection), method: :post, class: "btn btn--link btn--circle-mobile" do %>
|
||||
<%= icon_tag "add" %>
|
||||
<span>Add a card</span>
|
||||
Reference in New Issue
Block a user