Rename the search param for clarity
This commit is contained in:
@@ -6,8 +6,8 @@ class BubblesController < ApplicationController
|
||||
def index
|
||||
@bubbles = @bucket.bubbles.not_popped
|
||||
|
||||
if params[:filter].present?
|
||||
@bubbles = @bubbles.mentioning(params[:filter])
|
||||
if params[:term].present?
|
||||
@bubbles = @bubbles.mentioning(params[:term])
|
||||
end
|
||||
|
||||
if params[:tag_id]
|
||||
|
||||
@@ -20,4 +20,8 @@ module BubblesHelper
|
||||
|
||||
"--bubble-size: var(--bubble-size-#{rank});"
|
||||
end
|
||||
|
||||
def bubble_filter_params
|
||||
params.permit(:term, :tag_id, :assignee_id)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
<% filter_params = params.permit(:filter, :tag_id, :assignee_id) %>
|
||||
|
||||
<h1 class="txt-large">
|
||||
<div class="filter" data-controller="dialog" data-action="keydown.esc->dialog#close">
|
||||
<button class="btn btn--plain filter__button" data-action="click->dialog#toggle" data-dialog-modal-value="true">
|
||||
@@ -46,13 +44,13 @@
|
||||
<dialog class="filter__popup panel fill-white shadow" data-dialog-target="dialog">
|
||||
<menu class="filter__menu flex flex-column gap-half unpad margin-none txt-medium">
|
||||
<% Current.account.tags.order(:title).each do |tag| %>
|
||||
<li><%= link_to tag.title, bucket_bubbles_path(bucket, filter_params.merge(tag_id: tag.id)) %></li>
|
||||
<li><%= link_to tag.title, bucket_bubbles_path(bucket, bubble_filter_params.merge(tag_id: tag.id)) %></li>
|
||||
<% end %>
|
||||
</menu>
|
||||
</dialog>
|
||||
|
||||
<% if tag %>
|
||||
<%= link_to bucket_bubbles_path(bucket, filter_params.without(:tag_id)), class: "btn", style: "font-size: 0.4em;" do %>
|
||||
<%= link_to bucket_bubbles_path(bucket, bubble_filter_params.without(:tag_id)), class: "btn", style: "font-size: 0.4em;" do %>
|
||||
<%= image_tag "remove.svg", aria: { hidden: true }, size: 24 %>
|
||||
<span class="for-screen-reader">Clear</span>
|
||||
<% end %>
|
||||
@@ -69,13 +67,13 @@
|
||||
<dialog class="filter__popup panel fill-white shadow" data-dialog-target="dialog">
|
||||
<menu class="filter__menu flex flex-column gap-half unpad margin-none txt-medium">
|
||||
<% Current.account.users.order(:name).each do |user| %>
|
||||
<li><%= link_to user.name, bucket_bubbles_path(bucket, filter_params.merge(assignee_id: user.id)) %></li>
|
||||
<li><%= link_to user.name, bucket_bubbles_path(bucket, bubble_filter_params.merge(assignee_id: user.id)) %></li>
|
||||
<% end %>
|
||||
</menu>
|
||||
</dialog>
|
||||
|
||||
<% if assignee %>
|
||||
<%= link_to bucket_bubbles_path(bucket, filter_params.without(:assignee_id)), class: "btn", style: "font-size: 0.4em;" do %>
|
||||
<%= link_to bucket_bubbles_path(bucket, bubble_filter_params.without(:assignee_id)), class: "btn", style: "font-size: 0.4em;" do %>
|
||||
<%= image_tag "remove.svg", aria: { hidden: true }, size: 24 %>
|
||||
<span class="for-screen-reader">Clear</span>
|
||||
<% end %>
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
<section class="bubbles-list unpad-inline center margin-block-start">
|
||||
<header class="flex-inline align-center gap txt-small margin-block-end-half center">
|
||||
<form class="flex-item-no-shrink">
|
||||
<input type="search" name="filter" class="input center flex-inline" placeholder="Type to filter…" value="<%= params[:filter] %>">
|
||||
<% params.permit(:tag_id, :assignee_id).each do |name, value| %>
|
||||
<% search_field_tag :term, params[:term], class: "input center flex-inline", placeholder: "Type to filter…" %>
|
||||
<% bubble_filter_params.without(:term).each do |name, value| %>
|
||||
<%= hidden_field_tag name, value %>
|
||||
<% end %>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user