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.

Remove new link from the customer returns (#12487)

Damian Kaczmarczyk978750488c46
diff --git a/admin/app/views/spree/admin/customer_returns/index.html.erb b/admin/app/views/spree/admin/customer_returns/index.html.erb
index 77ccd5c50c..a66c7c0250 100644
--- a/admin/app/views/spree/admin/customer_returns/index.html.erb
+++ b/admin/app/views/spree/admin/customer_returns/index.html.erb
@@ -37,8 +37,20 @@
</table>
</div>
<% else %>
- <%= render "spree/admin/shared/no_resource_found" %>
+ <div
+ class="
+ text-muted p-5 d-flex align-items-center w-100 justify-content-center
+ "
+ >
+ <%= Spree.t(
+ :no_resource_found,
+ resource: plural_resource_name(Spree::CustomerReturn),
+ ) %>
+ </div>
<% end %>
- <%= render partial: "spree/admin/shared/index_table_options", locals: { collection: @collection } %>
+ <%= render partial: "spree/admin/shared/index_table_options",
+ locals: {
+ collection: @collection,
+ } %>
</div>
diff --git a/admin/spec/controllers/spree/admin/customer_returns_controller_spec.rb b/admin/spec/controllers/spree/admin/customer_returns_controller_spec.rb
index e23c55c315..56fef7679c 100644
--- a/admin/spec/controllers/spree/admin/customer_returns_controller_spec.rb
+++ b/admin/spec/controllers/spree/admin/customer_returns_controller_spec.rb
@@ -10,11 +10,19 @@ RSpec.describe Spree::Admin::CustomerReturnsController do
describe '#index' do
subject { get :index }
- before { subject }
-
it 'is successful' do
+ subject
expect(response).to be_successful
end
+
+ context 'when there are no customer returns' do
+ before { Spree::CustomerReturn.destroy_all }
+
+ it 'is successful' do
+ subject
+ expect(response).to be_successful
+ end
+ end
end
describe '#collection' do
diff --git a/admin/spec/controllers/spree/admin/return_authorizations_controller_spec.rb b/admin/spec/controllers/spree/admin/return_authorizations_controller_spec.rb
index 23f3443a73..efb50dd6fa 100644
--- a/admin/spec/controllers/spree/admin/return_authorizations_controller_spec.rb
+++ b/admin/spec/controllers/spree/admin/return_authorizations_controller_spec.rb
@@ -11,11 +11,19 @@ RSpec.describe Spree::Admin::ReturnAuthorizationsController do
describe '#index' do
subject { get :index }
- before { subject }
-
it 'is successful' do
+ subject
expect(response).to be_successful
end
+
+ context 'when there are no return authorizations' do
+ before { Spree::ReturnAuthorization.destroy_all }
+
+ it 'is successful' do
+ subject
+ expect(response).to be_successful
+ end
+ end
end
describe '#cancel' do