Add a JSON cards endpoint for workflow columns (#2800)
* Add JSON endpoint for cards in workflow columns * Add cards URL to column JSON responses * Add coverage for column cards authorization
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
class Boards::Columns::CardsController < ApplicationController
|
||||
include BoardScoped
|
||||
|
||||
before_action :set_column
|
||||
|
||||
def index
|
||||
set_page_and_extract_portion_from @column.cards.active.latest.with_golden_first.preloaded
|
||||
fresh_when etag: @page.records
|
||||
|
||||
respond_to do |format|
|
||||
format.json
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def set_column
|
||||
@column = @board.columns.find(params[:column_id])
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1 @@
|
||||
json.array! @page.records, partial: "cards/card", as: :card
|
||||
@@ -1,4 +1,5 @@
|
||||
json.cache! column do
|
||||
json.(column, :id, :name, :color)
|
||||
json.created_at column.created_at.utc
|
||||
json.cards_url board_column_cards_url(column.board, column)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user