Skip to content

Commit

Permalink
Review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubkottnauer committed May 21, 2024
1 parent 6b42442 commit a620ba0
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Transactions::Categories::DropdownsController < ApplicationController
def new
@transaction = Transaction.find(params[:id])
end
end
6 changes: 5 additions & 1 deletion app/views/transactions/categories/_menu.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
</button>
<div data-menu-target="content" class="absolute z-10 hidden w-screen mt-2 max-w-min cursor-default">
<div class="w-64 text-sm font-semibold leading-6 text-gray-900 bg-white shadow-lg shrink rounded-xl ring-1 ring-gray-900/5">
<%= turbo_frame_tag "category_menu_content", src: category_menu_content_transaction_path(transaction), loading: :lazy %>
<%= turbo_frame_tag "category_menu_content", src: categories_dropdown_transaction_path(transaction), loading: :lazy do %>
<div class="p-6 flex items-center justify-center">
<p class="text-sm text-gray-500 animate-pulse"><%= t(".loading") %></p>
</div>
<% end %>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</div>
<% sorted_categories = Current.family.transaction_categories.sort_by { |category| category.id == @transaction.category_id ? 0 : 1 } %>
<% sorted_categories.each do |category| %>
<%= render partial: "transactions/categories/dropdown/row", locals: { category:, transaction: @transaction } %>
<%= render partial: "transactions/categories/dropdowns/row", locals: { category:, transaction: @transaction } %>
<% end %>
</div>
<hr>
Expand Down
10 changes: 6 additions & 4 deletions config/locales/views/transaction/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ en:
category will be uncategorized. Instead of leaving them uncategorized,
you can also assign a new category below.
replacement_category_prompt: Select category
dropdown:
dropdowns:
new:
add_new: Add new
clear: Clear
row:
delete: Delete category
edit: Edit category
Expand All @@ -28,16 +31,15 @@ en:
index:
categories: Categories
new: New
menu:
loading: Loading...
new:
new_category: New category
row:
delete: Delete category
edit: Edit category
update:
success: Transaction category updated successfully
category_menu_content:
add_new: Add new
clear: Clear
create:
success: New transaction created successfully
destroy:
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

resources :transactions do
match "search" => "transactions#search", on: :collection, via: %i[ get post ], as: :search
get :category_menu_content, on: :member
get "categories/dropdown" => "transactions/categories/dropdowns#new", only: %i[ new ], on: :member

collection do
scope module: :transactions do
Expand Down

0 comments on commit a620ba0

Please sign in to comment.