Skip to content

Commit

Permalink
fixup! Update RequestController#list action to handle tags
Browse files Browse the repository at this point in the history
  • Loading branch information
gbp committed Apr 17, 2024
1 parent 50dbd0a commit b5f92fb
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions app/controllers/request_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,14 @@ def list
@filters, @page, @per_page, @max_results
)

@category = InfoRequest.category_list.find_by(category_tag: @tag) if @tag
if @category
@title = n_('Found {{count}} request in the category ‘{{category}}’',
'Found {{count}} requests in the category ‘{{category}}’',
@results[:matches_estimated],
count: @results[:matches_estimated],
category: @category.title)
elsif @tag
@title = n_('Found {{count}} request tagged ‘{{tag_name}}’',
'Found {{count}} requests tagged ‘{{tag_name}}’',
@results[:matches_estimated],
count: @results[:matches_estimated],
tag_name: @tag)
if @tag
@category = InfoRequest.category_list.find_by(category_tag: @tag)
@title = @category&.title
@title ||= n_('Found {{count}} request tagged ‘{{tag_name}}’',
'Found {{count}} requests tagged ‘{{tag_name}}’',
@results[:matches_estimated],
count: @results[:matches_estimated],
tag_name: @tag)
elsif @page > 1
@title = _("Browse and search requests (page {{count}})", count: @page)
else
Expand Down

0 comments on commit b5f92fb

Please sign in to comment.