Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Stores Admin list Ux fixes

Damian Legawiec9e6352b7aca1
diff --git a/backend/app/views/spree/admin/stores/index.html.erb b/backend/app/views/spree/admin/stores/index.html.erb
index 753550f919..e84a3966ed 100644
--- a/backend/app/views/spree/admin/stores/index.html.erb
+++ b/backend/app/views/spree/admin/stores/index.html.erb
@@ -24,10 +24,15 @@
<td><%= store.default_currency %></td>
<td><%= active_badge(store.default) %></td>
<td class="actions actions-2 text-right" data-hook="admin_stores_index_row_actions">
- <% if can?(:edit, store) && !store.default %>
- <%= link_to_with_icon('save.svg', Spree.t(:store_set_default_button), spree.set_default_admin_store_path(store), no_text: true, method: :put, class: 'btn btn-warning btn-sm with-tip') %>
- <% end %>
<%= link_to_edit_url spree.edit_admin_store_path(store), no_text: true if can?(:edit, store) %>
+
+ <% if can?(:edit, store) %>
+ <% btn_url = store.default? ? '#' : spree.set_default_admin_store_path(store) %>
+ <% btn_class = store.default? ? 'inactive' : 'warning' %>
+ <% btn_label = store.default? ? nil : Spree.t(:store_set_default_button) %>
+ <%= link_to_with_icon('save.svg', btn_label, btn_url, no_text: true, method: (store.default? ? nil : :put), class: "btn btn-#{btn_class} btn-sm with-tip") %>
+ <% end %>
+
<%= link_to_delete store, no_text: true, url: spree.admin_store_path(store) if can?(:destroy, store) %>
</td>
</tr>