Sha256: c3dc8e9ada8a5fd2eebd55a1b3be1bcd4b3afd16c6c0949d5acede07f5bdaf85

Contents?: true

Size: 1.78 KB

Versions: 17

Compression:

Stored size: 1.78 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])
      .append_query({view: @resource&.view&.to_s})
      .to_s
  %>
  <%= form_with scope: 'fields',
    url: url,
    local: true,
    data: {
      'turbo-frame': '_top'
    } do |form| %>
    <%= render Avo::ModalComponent.new do |c| %>
      <% c.with_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.is_searchable? %>
          <%= render Avo::Pro::SearchableAssociations::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.with_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

17 entries across 17 versions & 1 rubygems

Version Path
avo-3.5.8 app/views/avo/associations/new.html.erb
avo-3.5.7 app/views/avo/associations/new.html.erb
avo-3.5.6 app/views/avo/associations/new.html.erb
avo-3.5.6.beta1 app/views/avo/associations/new.html.erb
avo-3.5.5 app/views/avo/associations/new.html.erb
avo-3.5.4 app/views/avo/associations/new.html.erb
avo-3.5.3 app/views/avo/associations/new.html.erb
avo-3.5.2 app/views/avo/associations/new.html.erb
avo-3.5.1 app/views/avo/associations/new.html.erb
avo-3.5.0 app/views/avo/associations/new.html.erb
avo-3.4.4 app/views/avo/associations/new.html.erb
avo-3.4.3 app/views/avo/associations/new.html.erb
avo-3.4.2 app/views/avo/associations/new.html.erb
avo-3.4.1 app/views/avo/associations/new.html.erb
avo-3.4.0 app/views/avo/associations/new.html.erb
avo-3.3.6 app/views/avo/associations/new.html.erb
avo-3.3.5 app/views/avo/associations/new.html.erb