Sha256: 6e4d1ddc8a2b6b278030efa9bd666b40ebb73fb7b44fb9b9a8308707a3c50d66

Contents?: true

Size: 1.35 KB

Versions: 3

Compression:

Stored size: 1.35 KB

Contents

<%= turbo_frame_tag 'attach_modal' do %>
  <%= form_with scope: 'fields',
    url: "#{avo.root_path}resources/#{params[:resource_name]}/#{params[:id]}/#{params[:related_name]}/",
    data: {
      'turbo-frame': '_top'
    } do |form| %>
    <%= render Avo::ModalComponent.new do |c| %>
      <% c.heading do %>
        <%= t 'avo.choose_item', item: @related_resource.name.downcase %>
      <% end %>
      <div class="flex-1 flex items-center justify-center px-8 text-lg mt-8 mb-12">
        <% if @field.searchable %>
          <%= render Avo::Fields::BelongsToField::AutocompleteComponent.new form: form,
            field: @field,
            model_key: @field.target_resource&.model_key,
            foreign_key: 'related_id',
            resource: @resource
          %>
        <% else %>
          <div class="flex-1 flex flex-col items-center justify-center px-24 text-base">
            <%= form.select :related_id, options_for_select(@options, nil),
              { include_blank: t('avo.choose_an_option') },
              { class: input_classes('w-full') }
            %>
          </div>
        <% end %>
      </div>
      <% c.controls do %>
        <%= a_button t('avo.cancel'), 'data-action': 'click->modal#close', size: :sm %>
        <%= a_button t('avo.attach'), type: :submit, color: :green, size: :sm %>
      <% end %>
    <% end %>
  <% end %>
<% end %>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
avo-1.25.2 app/views/avo/relations/new.html.erb
avo-1.25.1 app/views/avo/relations/new.html.erb
avo-1.25.0 app/views/avo/relations/new.html.erb