1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-24 15:49:39 +02:00

Basic transaction categories CRUD actions (inline) (#601)

* Fix dropdown issues and add dummy transaction category modal

* Minor namings tweaks

* Add search type

* Use new menu controller

* Complete basic transaction category inline CRUD actions

* Fix lint error

---------

Co-authored-by: Jakub Kottnauer <jk@jakubkottnauer.com>
This commit is contained in:
Zach Gollwitzer 2024-04-04 17:29:50 -04:00 committed by GitHub
parent 315c4bf1ec
commit d29d465a3c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 254 additions and 101 deletions

View file

@ -0,0 +1,34 @@
class Transactions::CategoriesController < ApplicationController
before_action :set_category, only: [ :update, :destroy ]
def create
if Current.family.transaction_categories.create(category_params)
redirect_to transactions_path, notice: t(".success")
else
render transactions_path, status: :unprocessable_entity, notice: t(".error")
end
end
def update
if @category.update(category_params)
redirect_to transactions_path, notice: t(".success")
else
render transactions_path, status: :unprocessable_entity, notice: t(".error")
end
end
def destroy
@category.destroy!
redirect_to transactions_path, notice: t(".success")
end
private
def set_category
@category = Current.family.transaction_categories.find(params[:id])
end
def category_params
params.require(:transaction_category).permit(:name, :name, :color)
end
end