From 20dd87b2bf7d9b51051ed338fa4c0bf960ff98c9 Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Fri, 26 Sep 2025 11:28:58 +0200 Subject: [PATCH] Add add card button to the collection perma --- app/models/card/postponable.rb | 8 ++++---- app/views/collections/show/_columns.html.erb | 2 +- app/views/collections/show/_stream.html.erb | 8 ++++---- app/views/columns/show/_add_card_button.html.erb | 13 +++++++++++++ 4 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 app/views/columns/show/_add_card_button.html.erb diff --git a/app/models/card/postponable.rb b/app/models/card/postponable.rb index 9ed1c9e46..a22dc3704 100644 --- a/app/models/card/postponable.rb +++ b/app/models/card/postponable.rb @@ -4,16 +4,16 @@ module Card::Postponable included do has_one :not_now, dependent: :destroy, class_name: "Card::NotNow" - scope :postponed, -> { open.joins(:not_now) } - scope :active, -> { open.where.missing(:not_now) } + scope :postponed, -> { open.published.joins(:not_now) } + scope :active, -> { open.published.where.missing(:not_now) } end def postponed? - not_now.present? + open? && published? && not_now.present? end def active? - !postponed? + open? && published? && !postponed? end def postpone diff --git a/app/views/collections/show/_columns.html.erb b/app/views/collections/show/_columns.html.erb index 0a1a67136..90348ccbd 100644 --- a/app/views/collections/show/_columns.html.erb +++ b/app/views/collections/show/_columns.html.erb @@ -5,7 +5,7 @@ <%= render "collections/show/not_now", collection: collection %> - <%= render "collections/show/stream", page: page %> + <%= render "collections/show/stream", page: page, collection: collection %>
<%= render partial: "collections/show/column", collection: collection.columns, cached: true %> diff --git a/app/views/collections/show/_stream.html.erb b/app/views/collections/show/_stream.html.erb index 70c6970bc..2516e5168 100644 --- a/app/views/collections/show/_stream.html.erb +++ b/app/views/collections/show/_stream.html.erb @@ -3,6 +3,8 @@ data-drop-target="considering">
+ <%= render "columns/show/add_card_button", collection: collection %> + <% if page.used? %> <%= render "collections/columns/list", cards: @page.records, draggable: true %> @@ -10,9 +12,7 @@
<% end %> - <% else %> -
-

Drag cards here

-
<% end %> + +
diff --git a/app/views/columns/show/_add_card_button.html.erb b/app/views/columns/show/_add_card_button.html.erb new file mode 100644 index 000000000..86e926195 --- /dev/null +++ b/app/views/columns/show/_add_card_button.html.erb @@ -0,0 +1,13 @@ +
+ <%= button_to collection_cards_path(collection), method: :post, class: "btn btn--link", form: { data: { turbo_frame: "_top" } } do %> + <%= icon_tag "add" %> + Add a card + <% end %> + + + + +