Merge pull request 'Feature: Allow changing the status of guests in bulk' (#71) from bulk-status-changes into main
All checks were successful
Run unit tests / unit_tests (push) Successful in 3m11s
Build Nginx-based docker image / build-static-assets (push) Successful in 51m17s

Reviewed-on: #71
This commit is contained in:
bustikiller 2024-10-27 19:45:53 +00:00
commit 597a4a6b9c
4 changed files with 19 additions and 0 deletions

View File

@ -1,2 +1,13 @@
class ApplicationController < ActionController::Base class ApplicationController < ActionController::Base
after_action :set_csrf_cookie
private
def set_csrf_cookie
cookies["csrf-token"] = {
value: form_authenticity_token,
secure: Rails.env.production?,
same_site: :strict,
}
end
end end

View File

@ -75,6 +75,11 @@ class GuestsController < ApplicationController
redirect_to guests_url redirect_to guests_url
end end
def bulk_update
Guest.where(id: params[:guest_ids]).update!(params.require(:properties).permit(:status))
render json: {}, status: :ok
end
private private
# Use callbacks to share common setup or constraints between actions. # Use callbacks to share common setup or constraints between actions.

View File

@ -73,4 +73,6 @@ Rails.application.configure do
# Raise error when a before_action's only/except options reference missing actions # Raise error when a before_action's only/except options reference missing actions
config.action_controller.raise_on_missing_callback_actions = true config.action_controller.raise_on_missing_callback_actions = true
config.hosts << "libre-wedding-planner.app.localhost"
end end

View File

@ -2,6 +2,7 @@ Rails.application.routes.draw do
resources :groups, only: :index resources :groups, only: :index
resources :guests do resources :guests do
post :import, on: :collection post :import, on: :collection
post :bulk_update, on: :collection
end end
resources :expenses resources :expenses
resources :tables_arrangements, only: [:index, :show] resources :tables_arrangements, only: [:index, :show]