-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
utilizing the ListFilterComponent to display the value for 'in' and '…
…not_in' operators
- Loading branch information
Showing
12 changed files
with
250 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<% if %w[in not_in].any? { |operator| @condition.operator == operator } %> | ||
<div | ||
data-controller="list-filter" | ||
data-list-filter-selection-outlet="#samples-table" | ||
data-list-filter-filters-value="<%= @condition.value.present? ? @condition.value.to_s : '[]' %>" | ||
class="w-full list-filter value" | ||
> | ||
<template data-list-filter-target="template"> | ||
<%= viral_pill(color: :blue, classes: "search-tag inline-flex items-center filter-item mb-1 mr-1 py-1.5") do %> | ||
<%= @conditions_form.search_field :value, | ||
multiple: true, | ||
class: "hidden", | ||
data: "turbo-temporary" %> | ||
<span class="mr-1 font-mono text-base font-semibold label"></span> | ||
<button | ||
type="button" | ||
class=" | ||
inline-flex items-center p-1 text-sm bg-transparent rounded-full text-slate-400 | ||
hover:bg-blue-200 hover:text-blue-900 dark:hover:bg-blue-600 | ||
dark:hover:text-blue-300 | ||
" | ||
data-action="click->list-filter#remove" | ||
aria-label="<%= t(:'components.list_filter.remove_tag') %>" | ||
> | ||
<%= viral_icon(name: "x_mark", classes: "w-4 h-4") %> | ||
</button> | ||
<% end %> | ||
</template> | ||
<div | ||
class=" | ||
relative flex flex-wrap font-mono bg-slate-50 border border-slate-300 | ||
text-slate-900 text-sm rounded-lg focus-within:ring-primary-500 | ||
focus-within:border-primary-500 w-full p-2.5 dark:bg-slate-700 | ||
dark:border-slate-600 dark:placeholder-slate-400 dark:text-white | ||
dark:focus-within:ring-primary-500 dark:focus-within:border-primary-500k | ||
" | ||
data-list-filter-target="tags" | ||
data-action="click->list-filter#focus" | ||
> | ||
<input | ||
type="text" | ||
name="<%="q[groups_attributes][#{@group_index}][conditions_attributes][#{@condition_index}][value][]"%>" | ||
class="bg-transparent border-none focus:outline-none focus:ring-0 grow" | ||
autofocus | ||
aria-label="<%= t(:'components.list_filter.description') %>" | ||
data-action=' | ||
keydown->list-filter#handleInput | ||
paste->list-filter#handlePaste | ||
turbo:morph-element->list-filter#idempotentConnect | ||
' | ||
data-list-filter-target="input" | ||
/> | ||
<button | ||
type="button" | ||
class=" | ||
absolute inline-flex items-center justify-center w-5 h-5 text-xs font-bold | ||
rounded-full text-slate-600 bg-slate-100 border-3 border-slate-10 bottom-2 end-2 | ||
dark:text-slate-300 dark:border-slate-900 dark:bg-slate-600 | ||
dark:hover:bg-slate-500 hover:bg-slate-300 | ||
" | ||
data-action="click->list-filter#clear" | ||
aria-label="<%= t(:'components.list_filter.clear') %>" | ||
title="<%= t(:'components.list_filter.clear') %>" | ||
> | ||
<%= viral_icon(name: "x_mark", classes: "h-4 w-4") %> | ||
</button> | ||
</div> | ||
</div> | ||
<% else %> | ||
<%= @conditions_form.text_field( | ||
:value, | ||
placeholder: t("advanced_search_component.value"), | ||
"aria-label": t("advanced_search_component.value"), | ||
class: | ||
"keyInput block py-2.5 px-0 w-full text-sm text-slate-900 bg-transparent border-0 border-b-2 border-slate-300 appearance-none dark:text-white dark:border-slate-600 dark:focus:border-primary-500 focus:outline-none focus:ring-0 focus:border-primary-500 peer value", | ||
) %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
module AdvancedSearch | ||
# Component for rendering an advanced search value | ||
class Value < Component | ||
def initialize(conditions_form:, group_index:, condition:, condition_index:) | ||
@conditions_form = conditions_form | ||
@group_index = group_index | ||
@condition = condition | ||
@condition_index = condition_index | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.