Sha256: f2a6ce30031cffc876364d91829a31c9e9572cf10e57ded60061e3d7c983b2ee

Contents?: true

Size: 1.79 KB

Versions: 3

Compression:

Stored size: 1.79 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,
      type: :text,
      value: field_label,
      class: helpers.input_classes('w-full', has_error: @field.model_errors.include?(@field.id)),
      placeholder: @field.placeholder,
      'data-search-target': 'button clearValue',
      # 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-should-be-disabled': @disabled,
      disabled: true %>
    <% unless @disabled %>
      <div class="absolute top-1/2 left-auto right-3 mr-px -mt-2 cursor-pointer hidden text-gray-500"
        data-tippy="tooltip"
        data-search-target="clearButton"
        title="<%= I18n.translate 'avo.clear_value' %>"
        data-action="click->search#clearValue"
        ><%= helpers.svg 'x', class: 'h-4' %>
      </div>
    <% end %>
  </div>
  <%= @form.hidden_field @foreign_key, value: field_value, 'data-search-target': 'hiddenId clearValue' %>
</div>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
avo-2.7.1.pre.1 app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb
avo-2.7.0 app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb
avo-2.6.1.pre.2 app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb