Sha256: f9a4702082a6ed14874ec9a2161c87c0384b1f61d0f4ce1c4fcda7a7c28b9fe8

Contents?: true

Size: 1.71 KB

Versions: 20

Compression:

Stored size: 1.71 KB

Contents

<%= turbo_frame_tag 'attach_modal' do %>
  <%
    url = Avo::Services::URIService.parse(avo.root_url.to_s)
      .append_paths('resources', params[:resource_name], params[:id], params[:related_name])
      .to_s
  %>
  <%= form_with scope: 'fields',
    url: url,
    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, style: :outline, color: :gray do %>
          <%= t('avo.cancel') %>
        <% end %>
        <%= a_button type: :submit, style: :primary, color: :green, size: :sm do %>
          <%= t('avo.attach') %>
        <% end %>
      <% end %>
    <% end %>
  <% end %>
<% end %>

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
avo-2.30.2 app/views/avo/associations/new.html.erb
avo-2.30.1 app/views/avo/associations/new.html.erb
avo-2.30.1.pre4.pr1683 app/views/avo/associations/new.html.erb
avo-2.30.1.pre3.pr1683 app/views/avo/associations/new.html.erb
avo-2.30.1.pre2.pr1683 app/views/avo/associations/new.html.erb
avo-2.30.1.pre1.pr1683 app/views/avo/associations/new.html.erb
avo-2.30.0 app/views/avo/associations/new.html.erb
avo-2.29.1 app/views/avo/associations/new.html.erb
avo-2.29.1.pre.pr1652 app/views/avo/associations/new.html.erb
avo-2.29.0 app/views/avo/associations/new.html.erb
avo-2.28.3.pre.pr1646 app/views/avo/associations/new.html.erb
avo-2.28.2.pre.pr1642 app/views/avo/associations/new.html.erb
avo-2.28.1.pre.pr1642 app/views/avo/associations/new.html.erb
avo-2.28.0 app/views/avo/associations/new.html.erb
avo-2.27.2.pre.pr1606 app/views/avo/associations/new.html.erb
avo-2.27.1 app/views/avo/associations/new.html.erb
avo-2.27.0 app/views/avo/associations/new.html.erb
avo-2.26.3.pre.pr1601 app/views/avo/associations/new.html.erb
avo-2.26.2.pre.pr1579 app/views/avo/associations/new.html.erb
avo-2.25.1.pre.1.pr1579 app/views/avo/associations/new.html.erb