Files
openfoodnetwork/app/views/admin/enterprises/_admin_index.html.haml
David Rodríguez 6aa7ef3c21 Improve enterprise removal (success case)
Make enterprise removal use turbo, which provides the following
benefits:

* More responsive removal since there's no full page reload.
* A success flash message (previously nothing was displayed).
* No double alert prompt.

It also goes in the direction of removing mrujs in favor of turbo.
2025-11-27 19:09:35 +01:00

43 lines
1.7 KiB
Plaintext

= form_for @enterprise_set, url: main_app.bulk_update_admin_enterprises_path do |f|
%table#listing_enterprises.index
%colgroup
%col{style: "width: 25%;"}/
%col{style: "width: 15%;"}/
%col{style: "width: 5%;"}/
- if spree_current_user.admin?
%col{style: "width: 12%;"}/
- if spree_current_user.admin?
%col{style: "width: 18%;"}/
%col{style: "width: 25%;"}/
%thead
%tr
%th= t('.name')
%th= t('.role')
- if spree_current_user.admin?
%th= t('.sells')
%th= t('.visible')
- if spree_current_user.admin?
%th= t('.owner')
%th
%tbody
= f.fields_for :collection do |enterprise_form|
- enterprise = enterprise_form.object
%tr{class: "enterprise-#{enterprise.id}", id: "resource-#{enterprise.id}"}
%td= link_to enterprise.name, main_app.edit_admin_enterprise_path(enterprise)
%td
= enterprise_form.check_box :is_primary_producer
= t('.producer')
- if spree_current_user.admin?
%td= enterprise_form.select :sells, enterprise_sells_options, {}, class: 'select2 fullwidth'
%td= enterprise_form.check_box :visible, {}, 'public', 'hidden'
- if spree_current_user.admin?
%td= enterprise_form.select :owner_id, enterprise.users.map{ |e| [ e.email, e.id ] }, {}, class: "select2 fullwidth"
%td.enterprise-actions
= render 'actions', enterprise: enterprise
- if @enterprises.empty?
%tr
%td{colspan: "4"}= t(:none)
= f.submit t(:update)
= render partial: 'admin/shared/pagy_links', locals: { pagy: @pagy }