<% button_classes = "text-gray-600 h-6 hover:text-gray-600" %> <%= render Avo::Index::Ordering::ButtonsComponent.new resource: @resource, reflection: @reflection, view_type: @view_type %> <% if can_view? %> <%= link_to helpers.svg('eye', class: button_classes), show_path, title: t('avo.view_item', item: singular_resource_name).capitalize, data: { target: 'control:view', control: :show, 'tippy': 'tooltip', } %> <% end %> <% if can_edit? %> <%= link_to helpers.svg('edit', class: button_classes), edit_path, title: t('avo.edit_item', item: singular_resource_name).capitalize, data: { target: 'control:edit', control: :edit, 'resource-id': @resource.model.id, 'tippy': 'tooltip', } %> <% end %> <% if can_detach? %> <%= form_with url: helpers.resource_detach_path(params[:resource_name], params[:id], params[:related_name], @resource.model.id), method: :delete, html: { 'data-turbo-frame': params[:turbo_frame] } do |form| %> <%= form.button helpers.svg('detach', class: button_classes), title: t('avo.detach_item', item: singular_resource_name).capitalize, type: :submit, data: { target: 'control:detach', confirm: t('avo.are_you_sure_detach_item', item: singular_resource_name), control: :detach, 'resource-id': @resource.model.id, 'tippy': 'tooltip', } %> <%= hidden_field_tag :turbo_frame, params[:turbo_frame], id: "turbo_frame_detach_#{@resource.model.id}" if params[:turbo_frame] %> <%= hidden_field_tag :referrer, request.fullpath, id: "referrer_detach_#{@resource.model.id}" if params[:turbo_frame] %> <% end %> <% end %> <% if can_delete? %> <%= form_with url: helpers.resource_path(model: @resource.model, resource: @resource), method: :delete, class: 'flex items-center', html: { 'data-turbo-frame': params[:turbo_frame] } do |form| %> <%= form.button helpers.svg('trash', class: button_classes), title: t('avo.delete_item', item: singular_resource_name).capitalize, type: :submit, data: { target: 'control:destroy', confirm: t('avo.are_you_sure', item: singular_resource_name), control: :destroy, 'resource-id': @resource.model.id, 'tippy': 'tooltip', } %> <%= form.hidden_field :view_type, value: params[:view_type], id: "turbo_view_type_#{@resource.model.id}" if params[:view_type] %> <%= form.hidden_field :turbo_frame, value: params[:turbo_frame], id: "turbo_frame_destroy_#{@resource.model.id}" if params[:turbo_frame] %> <%= form.hidden_field :referrer, value: request.fullpath, id: "referrer_destroy_#{@resource.model.id}" if params[:turbo_frame] %> <% end %> <% end %>