Sha256: 707b9b7f2b5a5b5ef55d50fbef5cd4e380102d8576bfe0f772ffd78bf46b2b83

Contents?: true

Size: 1.99 KB

Versions: 10

Compression:

Stored size: 1.99 KB

Contents

<%= content_tag :div,
  data: {
    model_name: @resource.model_name.to_s,
    resource_name: @resource.class.to_s,
    record_id: @resource.record.id,
    selected_resources_name: @resource.model_key,
    selected_resources: [@resource.record.id],
    **@resource.stimulus_data_attributes
  } do %>
  <%= render Avo::PanelComponent.new(name: title, description: @resource.description, display_breadcrumbs: @reflection.blank?, index: 0, data: { panel_id: "main" }) do |c| %>
    <% c.with_tools do %>
      <% @resource.render_show_controls.each do |control| %>
        <%= render_control control %>
      <% end %>
    <% end %>
    <% if main_panel.present? %>
      <% c.with_body do %>
        <%# the overflow helps with long values %>
        <div class="divide-y overflow-auto">
          <% main_panel.items.each_with_index do |field, index| %>
            <%= render field
              .hydrate(resource: @resource, record: @resource.record, user: @resource.user, view: view)
              .component_for_view(view)
              .new(field: field, resource: @resource, index: index, compact: sidebar.present?)
            %>
          <% end %>
        </div>
      <% end %>
    <% end %>
    <% if sidebar.present? %>
      <% c.with_sidebar do %>
        <%= render sidebar_component %>
      <% end %>
    <% end %>
  <% end %>
  <% if @reflection.blank? %>
    <%= content_tag :div, class: 'space-y-12 mt-12' do %>
      <% @resource.get_items.each_with_index do |item, index| %>
        <% next if item.nil? %>
        <%= render Avo::ItemSwitcherComponent.new resource: @resource, reflection: @reflection, item: item, index: index + 1, view: @view %>
      <% end %>
    <% end %>
  <% end %>
  <% if should_display_invalid_fields_errors? %>
    <turbo-stream action="append" target="alerts">
      <template>
        <% @resource.invalid_fields.each do |error| %>
          <%= render Avo::AlertComponent.new :error, error[:message] %>
        <% end %>
      </template>
    </turbo-stream>
  <% end %>
<% end %>

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
avo-3.0.1.beta2 app/components/avo/views/resource_show_component.html.erb
avo-3.0.0.beta1 app/components/avo/views/resource_show_component.html.erb
avo-3.0.1.beta1 app/components/avo/views/resource_show_component.html.erb
avo-3.0.0.pre17 app/components/avo/views/resource_show_component.html.erb
avo-3.0.0.pre18 app/components/avo/views/resource_show_component.html.erb
avo-3.0.0.pre14 app/components/avo/views/resource_show_component.html.erb
avo-3.0.0.pre16 app/components/avo/views/resource_show_component.html.erb
avo-3.0.0.pre15 app/components/avo/views/resource_show_component.html.erb
avo-3.0.0.pre13 app/components/avo/views/resource_show_component.html.erb
avo-3.0.0.pre12 app/components/avo/views/resource_show_component.html.erb