Make it possible to select investments without JavaScript

This commit is contained in:
Javi Martín
2024-10-09 13:03:27 +02:00
parent 54a48d63e1
commit 173b1bb07c
2 changed files with 26 additions and 2 deletions

View File

@@ -64,14 +64,20 @@ class Admin::BudgetInvestmentsController < Admin::BaseController
authorize! :select, @investment
@investment.update!(selected: true)
render :toggle_selection
respond_to do |format|
format.html { redirect_to request.referer, notice: t("flash.actions.update.budget_investment") }
format.js { render :toggle_selection }
end
end
def deselect
authorize! :deselect, @investment
@investment.update!(selected: false)
render :toggle_selection
respond_to do |format|
format.html { redirect_to request.referer, notice: t("flash.actions.update.budget_investment") }
format.js { render :toggle_selection }
end
end
private