Skip to content

Commit

Permalink
Add no-options message for empty filter
Browse files Browse the repository at this point in the history
  • Loading branch information
rainerdema committed Oct 10, 2023
1 parent ef86996 commit 6e78e0a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,33 @@
</div>
<% end %>
<div class="py-1 max-h-[240px] overflow-y-auto" role="menu" aria-orientation="vertical" aria-labelledby="options-menu" data-<%= stimulus_id %>-target="menu">
<% @selections.each do |selection| %>
<div class="px-4 py-2" data-<%= stimulus_id %>-target="option">
<input type="hidden" form="<%= @form %>"
name="<%= selection.attribute.name %>"
value="<%= selection.attribute.value %>">
<input type="hidden" form="<%= @form %>"
name="<%= selection.predicate.name %>"
value="<%= selection.predicate.value %>">
<% if @selections.any? %>
<% @selections.each do |selection| %>
<div class="px-4 py-2" data-<%= stimulus_id %>-target="option">
<input type="hidden" form="<%= @form %>"
name="<%= selection.attribute.name %>"
value="<%= selection.attribute.value %>">
<input type="hidden" form="<%= @form %>"
name="<%= selection.predicate.name %>"
value="<%= selection.predicate.value %>">

<%= render component('ui/forms/checkbox').new(
id: selection.id,
name: selection.option.name,
value: selection.option.value,
checked: selection.checked,
size: :s,
form: @form,
"data-action": "#{stimulus_id}#search #{stimulus_id}#sortCheckboxes",
"data-#{stimulus_id}-target": "checkbox"
) %>
<%= render component('ui/forms/checkbox').new(
id: selection.id,
name: selection.option.name,
value: selection.option.value,
checked: selection.checked,
size: :s,
form: @form,
"data-action": "#{stimulus_id}#search #{stimulus_id}#sortCheckboxes",
"data-#{stimulus_id}-target": "checkbox"
) %>
<%= label_tag selection.id, selection.presentation, class: "ml-2 text-sm text-gray-700" %>
<%= label_tag selection.id, selection.presentation, class: "ml-2 text-sm text-gray-700" %>
</div>
<% end %>
<% else %>
<div class="px-4 py-2 text-sm text-gray-700">
<%= t('.no_filter_options') %>
</div>
<% end %>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
# Use the translation in the example in your template with `t(".hello")`.
en:
search: Search
no_filter_options: No options available

0 comments on commit 6e78e0a

Please sign in to comment.