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.

Fix Promotion Pagination (#11188)

Matthew Kennedy4f9a0891d0be
diff --git a/backend/app/views/spree/admin/promotions/index.html.erb b/backend/app/views/spree/admin/promotions/index.html.erb
index ec64e72b1d..7bba47b0bf 100644
--- a/backend/app/views/spree/admin/promotions/index.html.erb
+++ b/backend/app/views/spree/admin/promotions/index.html.erb
@@ -42,43 +42,42 @@
</div>
<% end %>
-<%= paginate @promotions, theme: 'admin-twitter-bootstrap-4' %>
-
<% if @promotions.any? %>
-<div class="table-responsive">
- <table class="table">
- <thead>
- <tr>
- <th><%= Spree.t(:name) %></th>
- <th><%= Spree.t(:code) %></th>
- <th><%= Spree.t(:description) %></th>
- <th><%= Spree.t(:usage_limit) %></th>
- <th><%= Spree.t(:promotion_uses) %></th>
- <th><%= Spree.t(:expiration) %></th>
- <th data-hook="admin_promotions_index_header_actions" class="actions"></th>
- </tr>
- </thead>
- <tbody>
- <% @promotions.each do |promotion| %>
- <tr id="<%= spree_dom_id promotion %>">
- <td><%= link_to promotion.name, edit_admin_promotion_path(promotion) %></td>
- <td><%= promotion.code %></td>
- <td><%= promotion.description %></td>
- <td><%= promotion.usage_limit.nil? ? "∞" : promotion.usage_limit %></td>
- <td><%= Spree.t(:current_promotion_usage, count: promotion.credits_count) %></td>
- <td><%= promotion.expires_at.to_date.to_s(:short_date) if promotion.expires_at %></td>
- <td class="actions" data-hook="admin_promotions_index_row_actions">
- <span class="d-flex justify-content-end">
- <%= link_to_edit promotion, no_text: true if can?(:edit, promotion) %>
- <%= link_to_clone_promotion promotion, no_text: true if can?(:clone, promotion) %>
- <%= link_to_delete promotion, no_text: true if can?(:delete, promotion) %>
- </span>
- </td>
+ <div class="table-responsive">
+ <table class="table">
+ <thead>
+ <tr>
+ <th><%= Spree.t(:name) %></th>
+ <th><%= Spree.t(:code) %></th>
+ <th><%= Spree.t(:description) %></th>
+ <th><%= Spree.t(:usage_limit) %></th>
+ <th><%= Spree.t(:promotion_uses) %></th>
+ <th><%= Spree.t(:expiration) %></th>
+ <th data-hook="admin_promotions_index_header_actions" class="actions"></th>
</tr>
- <% end %>
- </tbody>
- </table>
+ </thead>
+ <tbody>
+ <% @promotions.each do |promotion| %>
+ <tr id="<%= spree_dom_id promotion %>">
+ <td><%= link_to promotion.name, spree.edit_admin_promotion_path(promotion) %></td>
+ <td><%= promotion.code %></td>
+ <td><%= promotion.description %></td>
+ <td><%= promotion.usage_limit.nil? ? "∞" : promotion.usage_limit %></td>
+ <td><%= Spree.t(:current_promotion_usage, count: promotion.credits_count) %></td>
+ <td><%= promotion.expires_at.to_date.to_s(:short_date) if promotion.expires_at %></td>
+ <td class="actions" data-hook="admin_promotions_index_row_actions">
+ <span class="d-flex justify-content-end">
+ <%= link_to_edit promotion, no_text: true if can?(:edit, promotion) %>
+ <%= link_to_clone_promotion promotion, no_text: true if can?(:clone, promotion) %>
+ <%= link_to_delete promotion, no_text: true if can?(:delete, promotion) %>
+ </span>
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
</div>
+ <%= render 'spree/admin/shared/index_table_options', collection: @promotions, simple: true %>
<% else %>
<div class="alert alert-info no-objects-found">
<%= Spree.t(:no_resource_found, resource: plural_resource_name(Spree::Promotion)) %>,