Sha256: 43636d09d88516b5a84e39062810bab20df270888d54cecdc1e91394db862212

Contents?: true

Size: 1.58 KB

Versions: 22

Compression:

Stored size: 1.58 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]}/",
    local: true,
    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-0 lg:px-8 text-lg mt-8 mb-12">
        <% if @field.searchable %>
          <%= render Avo::Fields::BelongsToField::AutocompleteComponent.new form: form,
            classes: input_classes("w-full"),
            field: @field,
            model_key: @field.target_resource&.model_key,
            foreign_key: 'related_id',
            resource: @resource,
            view: :new
          %>
        <% else %>
          <div class="flex-1 flex flex-col items-center justify-center px-0 md: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 'data-action': 'click->modal#close', size: :sm do %>
          <%= t('avo.cancel') %>
        <% end %>
        <%= a_button type: :submit, color: :green, size: :sm do %>
          <%= t('avo.attach') %>
        <% end %>
      <% end %>
    <% end %>
  <% end %>
<% end %>

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
avo-2.14.3.pre.7.polytranslations1 app/views/avo/associations/new.html.erb
avo-2.14.3.pre.6.nosprockets app/views/avo/associations/new.html.erb
avo-2.14.3.pre.5.nosprockets app/views/avo/associations/new.html.erb
avo-2.14.3.pre.4.tosqlfix app/views/avo/associations/new.html.erb
avo-2.14.3.pre.3.jsbundling app/views/avo/associations/new.html.erb
avo-2.14.3.pre.2.tailwindcss app/views/avo/associations/new.html.erb
avo-2.14.2 app/views/avo/associations/new.html.erb
avo-2.14.2.pre.1 app/views/avo/associations/new.html.erb
avo-2.14.1 app/views/avo/associations/new.html.erb
avo-2.14.1.pre.1 app/views/avo/associations/new.html.erb
avo-2.14.0 app/views/avo/associations/new.html.erb
avo-2.13.6.pre.2 app/views/avo/associations/new.html.erb
avo-2.13.6.pre.1 app/views/avo/associations/new.html.erb
avo-2.13.5.pre.2 app/views/avo/associations/new.html.erb
avo-2.13.5.pre.1 app/views/avo/associations/new.html.erb
avo-2.13.4.pre.1 app/views/avo/associations/new.html.erb
avo-2.13.3.pre.4 app/views/avo/associations/new.html.erb
avo-2.13.3.pre.3 app/views/avo/associations/new.html.erb
avo-2.13.3.pre.2 app/views/avo/associations/new.html.erb
avo-2.13.3.pre.1 app/views/avo/associations/new.html.erb