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:
parent
32748b0632
commit
ac27a1c87f
7 changed files with 86 additions and 51 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue