Files
fizzy/app/controllers/public/collections/card_previews_controller.rb
T
Jorge Manrubia 80c4e6fd92 Format
2025-06-10 11:19:13 +02:00

25 lines
613 B
Ruby

class Public::Collections::CardPreviewsController < ApplicationController
include PublicCollectionScoped
allow_unauthenticated_access only: :index
def index
set_page_and_extract_portion_from find_cards, per_page: CardsController::PAGE_SIZE
end
private
def find_cards
case params[:target]
when "considering-cards"
@collection.cards.considering.latest
when "doing-cards"
@collection.cards.doing.latest
when "closed-cards"
@collection.cards.closed.recently_closed_first
else
head :bad_request
Card.none
end
end
end