Merge pull request #1001 from basecamp/scope-stage-filter
Scope stage filter
This commit is contained in:
@@ -23,11 +23,14 @@
|
||||
.card-columns {
|
||||
margin: auto;
|
||||
max-inline-size: 100%;
|
||||
min-block-size: 20lh;
|
||||
padding-inline: var(--reserved-bubble-space);
|
||||
position: relative;
|
||||
transition: 300ms ease-in-out;
|
||||
|
||||
&:has(.cards) {
|
||||
min-block-size: 20lh;
|
||||
}
|
||||
|
||||
&:before {
|
||||
background: var(--gradient-border);
|
||||
block-size: 1px;
|
||||
|
||||
@@ -28,7 +28,7 @@ class Filter < ApplicationRecord
|
||||
result = result.assigned_to(assignees.ids) if assignees.present?
|
||||
result = result.where(creator_id: creators.ids) if creators.present?
|
||||
result = result.where(collection: collections.ids) if collections.present?
|
||||
result = result.in_stage(stages.ids) if stages.present?
|
||||
result = result.in_stage(stages.ids) if stages.present? && engagement_status&.doing?
|
||||
result = result.tagged_with(tags.ids) if tags.present?
|
||||
result = result.where("cards.created_at": creation_window) if creation_window
|
||||
result = result.closed_at_window(closure_window) if closure_window
|
||||
|
||||
@@ -40,13 +40,15 @@
|
||||
dragover->drag-and-drop#dragOver
|
||||
drop->drag-and-drop#drop
|
||||
dragend->drag-and-drop#dragEnd" } do %>
|
||||
<% unless @filter.closers.any? %>
|
||||
<div class="card-columns" data-controller="related-element" data-related-element-highlight-class="cards--related">
|
||||
|
||||
<div class="card-columns" data-controller="related-element" data-related-element-highlight-class="cards--related">
|
||||
<% unless @filter.closers.any? %>
|
||||
<%= render "cards/index/engagement/on_deck", **@on_deck.to_h %>
|
||||
<%= render "cards/index/engagement/considering", **@considering.to_h %>
|
||||
<%= render "cards/index/engagement/doing", **@doing.to_h %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
<%= render "cards/index/engagement/closed", **@closed.to_h %>
|
||||
<% end %>
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
<strong class="popup__title margin-block-start-half pad-inline-half">In stage(s)…</strong>
|
||||
<%= form_with url: cards_path, method: :get, class: "popup__list",
|
||||
data: { controller: "form" } do |form| %>
|
||||
<% filter.as_params.except(:stage_ids).each do |key, value| %>
|
||||
<% filter.as_params.except(:stage_ids, :engagement_status).each do |key, value| %>
|
||||
<%= filter_hidden_field_tag key, value %>
|
||||
<% end %>
|
||||
|
||||
<%= link_to cards_path(filter.as_params.except(:stage_ids)), class: "popup__item btn" do %>
|
||||
<%= link_to cards_path(filter.as_params.except(:stage_ids, :engagement_status)), class: "popup__item btn" do %>
|
||||
<span class="overflow-ellipsis">All stages</span>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class FilterTest < ActiveSupport::TestCase
|
||||
assert_equal [ cards(:layout) ], filter.cards
|
||||
|
||||
filter = users(:david).filters.new stage_ids: [ workflow_stages(:qa_on_hold).id ]
|
||||
assert_equal [ cards(:logo), @new_card ], filter.cards
|
||||
assert_equal [ cards(:logo), cards(:layout), @new_card, cards(:text) ], filter.cards
|
||||
|
||||
filter = users(:david).filters.new assignment_status: "unassigned", collection_ids: [ @new_collection.id ]
|
||||
assert_equal [ @new_card ], filter.cards
|
||||
|
||||
Reference in New Issue
Block a user