mirror of
https://github.com/we-promise/sure.git
synced 2026-09-08 16:14:23 +00:00
Show category hierarchy in transaction picker (#3292)
This commit is contained in:
@@ -80,13 +80,22 @@
|
||||
</button>
|
||||
<% end %>
|
||||
|
||||
<% categories.each do |category| %>
|
||||
<% Category::Group.for(categories).each do |group| %>
|
||||
<%= render partial: "DS/category_select/option",
|
||||
locals: {
|
||||
category: category,
|
||||
selected: category.id.to_s == selected_id,
|
||||
category: group.category,
|
||||
selected: group.category.id.to_s == selected_id,
|
||||
view_helpers: helpers
|
||||
} %>
|
||||
|
||||
<% group.subcategories.each do |category| %>
|
||||
<%= render partial: "DS/category_select/option",
|
||||
locals: {
|
||||
category: category,
|
||||
selected: category.id.to_s == selected_id,
|
||||
view_helpers: helpers
|
||||
} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<button type="button"
|
||||
|
||||
@@ -15,6 +15,14 @@
|
||||
<%= view_helpers.icon("check") %>
|
||||
</span>
|
||||
|
||||
<% if category.parent_id.present? %>
|
||||
<span class="ml-2 shrink-0"
|
||||
data-testid="category-select-subcategory-indicator"
|
||||
style="color: <%= category.color %>">
|
||||
<%= view_helpers.icon("corner-down-right", size: "sm", color: "current") %>
|
||||
</span>
|
||||
<% end %>
|
||||
|
||||
<span data-category-select-badge>
|
||||
<%= view_helpers.render partial: "categories/badge",
|
||||
formats: [ :html ],
|
||||
|
||||
@@ -748,6 +748,11 @@ end
|
||||
assert_not_nil parent_index
|
||||
assert_not_nil child_index
|
||||
assert_equal parent_index + 1, child_index
|
||||
|
||||
child_option = wrapper.at_css("[data-category-id='#{categories(:subcategory).id}']")
|
||||
assert_not_nil child_option, "expected the subcategory option to render"
|
||||
assert child_option.at_css("[data-testid='category-select-subcategory-indicator']"),
|
||||
"expected the subcategory option to show the hierarchy indicator used in Settings"
|
||||
end
|
||||
|
||||
test "new renders a search box for account selection" do
|
||||
|
||||
Reference in New Issue
Block a user