Sha256: 63734cdc4f195b6ae365c49fd5cbdb2e934fd7315b89373785b509ade67bb3d7

Contents?: true

Size: 1.97 KB

Versions: 154

Compression:

Stored size: 1.97 KB

Contents

<div data-controller="search" class="resource-search flex items-center h-full w-full" data-turbo-remove-before-cache>
  <div class="w-full hidden"
    data-search-target="autocomplete"
    data-search-resource="<%= @model_key %>"
    data-translation-keys='{"no_item_found": "<%= I18n.translate 'avo.no_item_found' %>"}'
    data-via-association="belongs_to"
    data-via-association-id="<%= @field.id %>"
    data-via-reflection-id="<%= @field.model.id %>"
    data-via-reflection-class="<%= @field.model.class.to_s %>"
    data-via-parent-resource-id="<%= params[:via_resource_id] %>"
    data-via-parent-resource-class="<%= params[:via_relation_class] %>"
    data-via-relation="<%= params[:via_relation] %>"
  ></div>
  <div class="relative w-full" autocomplete="off">
    <%= @form.text_field @foreign_key,
      class: classes,
      # This instructs the search_controller if it should enable/disabled this field when the user switches polymorphic associations
      # It should not enable the field if the record is being created through an association
      data: {
        'search-target': 'button clearValue',
        'should-be-disabled': @disabled,
        **@field.get_html(:data, view: view, element: :input)
      },
      disabled: true,
      placeholder: @field.placeholder,
      style: @field.get_html(:style, view: view, element: :input),
      type: :text,
      value: field_label %>
    <% unless @disabled %>
      <button class="absolute top-1/2 left-auto right-3 mr-px -mt-2 cursor-pointer hidden text-gray-500"
        type="button"
        data-tippy="tooltip"
        data-search-target="clearButton"
        title="<%= I18n.translate 'avo.clear_value' %>"
        data-action="click->search#clearValue"
        ><%= helpers.svg 'x', class: 'h-4' %>
      </button>
    <% end %>
  </div>
  <%= @form.hidden_field @foreign_key,
    value: field_value,
    data: {
      'search-target': 'hiddenId clearValue',
      **@field.get_html(:data, view: view, element: :input)
    }
  %>
</div>

Version data entries

154 entries across 154 versions & 1 rubygems

Version Path
avo-2.53.0 app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb
avo-2.52.0 app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb
avo-2.49.0 app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb
avo-2.48.0 app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb
avo-2.47.0 app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb
avo-2.46.0 app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb
avo-2.45.0 app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb
avo-2.44.0 app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb
avo-2.43.0 app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb
avo-2.42.2 app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb
avo-2.42.1 app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb
avo-2.42.0 app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb
avo-2.41.0 app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb
avo-2.40.0 app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb
avo-2.39.0 app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb
avo-2.38.0 app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb
avo-2.37.2 app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb
avo-2.37.1 app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb
avo-2.37.0 app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb
avo-2.36.3 app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb