Add add card button to the collection perma

This commit is contained in:
Jorge Manrubia
2025-09-26 11:28:58 +02:00
parent 028e15cfca
commit 20dd87b2bf
4 changed files with 22 additions and 9 deletions
+4 -4
View File
@@ -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
+1 -1
View File
@@ -5,7 +5,7 @@
<%= render "collections/show/not_now", collection: collection %>
</div>
<%= render "collections/show/stream", page: page %>
<%= render "collections/show/stream", page: page, collection: collection %>
<div class="card-columns__right">
<%= render partial: "collections/show/column", collection: collection.columns, cached: true %>
+4 -4
View File
@@ -3,6 +3,8 @@
data-drop-target="considering">
<div class="cards__decoration"></div>
<%= render "columns/show/add_card_button", collection: collection %>
<% if page.used? %>
<%= render "collections/columns/list", cards: @page.records, draggable: true %>
@@ -10,9 +12,7 @@
<div class="full-width">
</div>
<% end %>
<% else %>
<div class="card blank-slate blank-slate--card">
<p class="txt-align-center txt-normal">Drag cards here</p>
</div>
<% end %>
<div class="cards__decoration cards__decoration--end"></div>
</section>
@@ -0,0 +1,13 @@
<div class="card card--new flex flex-column gap-half">
<%= button_to collection_cards_path(collection), method: :post, class: "btn btn--link", form: { data: { turbo_frame: "_top" } } do %>
<%= icon_tag "add" %>
<span>Add a card</span>
<% end %>
<hr class="separator--horizontal full-width" aria-hidden="true">
<footer class="flex flex-column align-center gap-half">
<strong class="txt-uppercase">Watching for new cards</strong>
<%= access_involvement_advance_button(collection, Current.user, show_watchers: true) %>
</footer>
</div>