1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-24 23:59:40 +02:00

Move category dropdown menu content into a turbo frame (#782)

* Move category dropdown menu content into a turbo frame

* Fix lint

* Review fixes

* Cleanup

* Review fixes

* Final cleanup

* Revert schema change
This commit is contained in:
Jakub Kottnauer 2024-05-22 12:31:25 +02:00 committed by GitHub
parent 32748b0632
commit ac27a1c87f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 86 additions and 51 deletions

View file

@ -15,7 +15,7 @@ class Transactions::Categories::DeletionsController < ApplicationController
private
def set_category
@category = Current.family.transaction_categories.find(params[:transaction_category_id])
@category = Current.family.transaction_categories.find(params[:category_id])
end
def set_replacement_category

View file

@ -0,0 +1,22 @@
class Transactions::Categories::DropdownsController < ApplicationController
before_action :set_from_params
def show
@categories = categories_scope.to_a.excluding(@selected_category).prepend(@selected_category).compact
end
private
def set_from_params
if params[:category_id]
@selected_category = categories_scope.find(params[:category_id])
end
if params[:transaction_id]
@transaction = Current.family.transactions.find(params[:transaction_id])
end
end
def categories_scope
Current.family.transaction_categories.alphabetically
end
end