Add JSON response format to board publication toggle (#2663)
This commit is contained in:
@@ -5,10 +5,20 @@ class Boards::PublicationsController < ApplicationController
|
||||
|
||||
def create
|
||||
@board.publish
|
||||
|
||||
respond_to do |format|
|
||||
format.turbo_stream
|
||||
format.json { render partial: "boards/board", locals: { board: @board }, status: :created }
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@board.unpublish
|
||||
@board.reload
|
||||
|
||||
respond_to do |format|
|
||||
format.turbo_stream
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,4 +4,6 @@ json.cache! board do
|
||||
json.url board_url(board)
|
||||
|
||||
json.creator board.creator, partial: "users/user", as: :user
|
||||
|
||||
json.public_url published_board_url(board) if board.published?
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user