Need a special human name for this one, move to a method

This commit is contained in:
Jason Zimdars
2025-10-31 16:41:50 -05:00
parent 8d58190483
commit ccbc7cd416
2 changed files with 14 additions and 2 deletions
+11
View File
@@ -14,6 +14,17 @@ module Filter::Fields
def default_value?(key, value)
default_values[key.to_sym].eql?(value)
end
def indexed_by_human_name(index)
case index
when "postponing_soon"
"Auto-closing soon"
when "all"
"Open"
else
index.humanize
end
end
end
included do
@@ -21,9 +21,10 @@
<ul class="popup__list" data-filter-target="list" role="listbox">
<% Filter::INDEXES.each do |index| %>
<%= tag.li class: "popup__item", data: { navigable_list_target: "item", combobox_target: "item", combobox_value: index, combobox_label: index.humanize }, role: "checkbox", aria: { checked: filter.indexed_by == index } do %>
<% label = Filter.indexed_by_human_name(index) %>
<%= tag.li class: "popup__item", data: { navigable_list_target: "item", combobox_target: "item", combobox_value: index, combobox_label: label }, role: "checkbox", aria: { checked: filter.indexed_by == index } do %>
<button type="button" class="btn popup__btn" data-action="dialog#close combobox#change filter-settings#change form#submit">
<span class="overflow-ellipsis flex-item-grow"><%= index == "all" ? "Open" : index.humanize %></span>
<span class="overflow-ellipsis flex-item-grow"><%= label %></span>
<%= icon_tag "check", class: "checked flex-item-justify-end" %>
</button>
<% end %>