mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-19 05:09:38 +02:00
Add inline category selection (#541)
* Implement inline category selection * Add turbo frame to refresh updated transaction * Improve styles * Fix category assignment * Reorganize code * Revert event propagation * Remove unused frames * Make only the transaction name clickable * Add custom scrollbar class
This commit is contained in:
parent
2c3752668a
commit
2c257a2a4b
13 changed files with 177 additions and 205 deletions
|
@ -35,7 +35,7 @@ class TransactionsController < ApplicationController
|
|||
|
||||
respond_to do |format|
|
||||
if @transaction.save
|
||||
format.html { redirect_to transaction_url(@transaction), notice: "Transaction was successfully created." }
|
||||
format.html { redirect_to transaction_url(@transaction), notice: t(".success") }
|
||||
else
|
||||
format.html { render :new, status: :unprocessable_entity }
|
||||
end
|
||||
|
@ -45,7 +45,13 @@ class TransactionsController < ApplicationController
|
|||
def update
|
||||
respond_to do |format|
|
||||
if @transaction.update(transaction_params)
|
||||
format.html { redirect_to transaction_url(@transaction), notice: "Transaction was successfully updated." }
|
||||
format.html { redirect_to transaction_url(@transaction), notice: t(".success") }
|
||||
format.turbo_stream do
|
||||
render turbo_stream: [
|
||||
turbo_stream.append("notification-tray", partial: "shared/notification", locals: { type: "success", content: t(".success") }),
|
||||
turbo_stream.replace("transaction_#{@transaction.id}", partial: "transactions/transaction", locals: { transaction: @transaction })
|
||||
]
|
||||
end
|
||||
else
|
||||
format.html { render :edit, status: :unprocessable_entity }
|
||||
end
|
||||
|
@ -56,7 +62,7 @@ class TransactionsController < ApplicationController
|
|||
@transaction.destroy!
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to transactions_url, notice: "Transaction was successfully destroyed." }
|
||||
format.html { redirect_to transactions_url, notice: t(".success") }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -68,6 +74,6 @@ class TransactionsController < ApplicationController
|
|||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def transaction_params
|
||||
params.require(:transaction).permit(:name, :date, :amount, :currency, :notes, :excluded)
|
||||
params.require(:transaction).permit(:name, :date, :amount, :currency, :notes, :excluded, :category_id)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue