Place recently closed cards first
This commit is contained in:
@@ -11,7 +11,7 @@ class CardsController < ApplicationController
|
||||
def index
|
||||
@considering = page_and_filter_for @filter.with(engagement_status: "considering", indexed_by: "latest"), per_page: PAGE_SIZE
|
||||
@doing = page_and_filter_for @filter.with(engagement_status: "doing", indexed_by: "latest"), per_page: PAGE_SIZE
|
||||
@closed = page_and_filter_for @filter.with(indexed_by: "closed"), per_page: PAGE_SIZE
|
||||
@closed = page_and_filter_for @filter.with(indexed_by: "closed") { |cards| cards.recently_closed_first }, per_page: PAGE_SIZE
|
||||
end
|
||||
|
||||
def create
|
||||
@@ -40,8 +40,10 @@ class CardsController < ApplicationController
|
||||
end
|
||||
|
||||
def page_and_filter_for(filter, per_page: nil)
|
||||
cards = block_given? ? yield(filter.cards) : filter.cards
|
||||
|
||||
OpenStruct.new \
|
||||
page: GearedPagination::Recordset.new(filter.cards, per_page:).page(1),
|
||||
page: GearedPagination::Recordset.new(cards, per_page:).page(1),
|
||||
filter: filter
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user