Pass filter to filter helpers

This commit is contained in:
Jose Farias
2024-10-28 10:06:56 -06:00
parent e92da7c73a
commit e8eb5ac243
3 changed files with 8 additions and 8 deletions
+6 -6
View File
@@ -3,17 +3,17 @@ module FiltersHelper
(Bucket::View::ORDERS[params[:order_by]] || Bucket::View::STATUSES[params[:status]] || Bubble.default_order_by).humanize
end
def tag_filter_text
if @filter&.tags
@filter.tags.map(&:hashtag).to_choice_sentence
def tag_filter_text(filter)
if filter.tags
filter.tags.map(&:hashtag).to_choice_sentence
else
"any tag"
end
end
def assignee_filter_text
if @filter&.assignees
"assigned to #{@filter.assignees.pluck(:name).to_choice_sentence}"
def assignee_filter_text(filter)
if filter.assignees
"assigned to #{filter.assignees.pluck(:name).to_choice_sentence}"
else
"assigned to anyone"
end
@@ -1,6 +1,6 @@
<div class="filter align-center gap-half" data-controller="dialog" data-action="keydown.esc->dialog#close click@document->dialog#closeOnClickOutside">
<button class="btn btn--plain filter__button" data-action="click->dialog#toggle" data-dialog-modal-value="true">
<%= assignee_filter_text %>
<%= assignee_filter_text filter %>
</button>
<dialog class="filter__popup panel fill-white shadow" data-dialog-target="dialog">
+1 -1
View File
@@ -1,6 +1,6 @@
<div class="filter align-center gap-half" data-controller="dialog" data-action="keydown.esc->dialog#close click@document->dialog#closeOnClickOutside">
<button class="btn btn--plain filter__button" data-action="click->dialog#toggle" data-dialog-modal-value="true">
<%= tag_filter_text %>
<%= tag_filter_text filter %>
</button>
<dialog class="filter__popup panel fill-white shadow" data-dialog-target="dialog">