diff --git a/app/components/advanced_search/condition.html.erb b/app/components/advanced_search/condition.html.erb index ffbcbc5f30..7f1b3aa315 100644 --- a/app/components/advanced_search/condition.html.erb +++ b/app/components/advanced_search/condition.html.erb @@ -9,7 +9,7 @@ { "aria-label": t("advanced_search_component.field"), class: - "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-primary-500 focus:border-primary-500 block p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-primary-500 dark:focus:border-primary-500", + "h-10 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-primary-500 focus:border-primary-500 block p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-primary-500 dark:focus:border-primary-500", } %> <%= conditions_form.select :operator, @operations, @@ -18,15 +18,15 @@ }, { "aria-label": t("advanced_search_component.operator"), + "data-action": "advanced-search#handleOperatorChange", class: - "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-primary-500 focus:border-primary-500 block p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-primary-500 dark:focus:border-primary-500", + "h-10 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-primary-500 focus:border-primary-500 block p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-primary-500 dark:focus:border-primary-500", } %> - <%= 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", + <%= render AdvancedSearch::Value.new( + conditions_form: conditions_form, + group_index: @group_index, + condition: @condition, + condition_index: @condition_index, ) %> <% end %> + + +<% 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 %> diff --git a/app/components/advanced_search/value.rb b/app/components/advanced_search/value.rb new file mode 100644 index 0000000000..7778e72f21 --- /dev/null +++ b/app/components/advanced_search/value.rb @@ -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 diff --git a/app/components/advanced_search_component.html.erb b/app/components/advanced_search_component.html.erb index 1ccc78709f..7bab5c9887 100644 --- a/app/components/advanced_search_component.html.erb +++ b/app/components/advanced_search_component.html.erb @@ -1,4 +1,7 @@ -
+
<%= viral_dialog(id: 'advanced-search-dialog', size: :large, open: @open) do |dialog| %> <%= dialog.with_trigger do %>