Skip to content

Commit

Permalink
Sort by name by default, allow sorting by start and end date
Browse files Browse the repository at this point in the history
  • Loading branch information
mamhoff committed Nov 8, 2023
1 parent 77e6323 commit 6fd6acc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def collection

@collection = super
@search = @collection.ransack(params[:q])
@search.sorts = "name asc" if @search.sorts.empty?
@collection = @search.result(distinct: true)
.includes(promotion_includes)
.page(params[:page])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<table class="index">
<thead>
<tr>
<th><%= SolidusFriendlyPromotions::Promotion.human_attribute_name(:name) %></th>
<th><%= sort_link @search, :name %></th>
<th><%= SolidusFriendlyPromotions::Promotion.human_attribute_name(:code) %></th>
<th><%= SolidusFriendlyPromotions::Promotion.human_attribute_name(:status) %></th>
<th><%= SolidusFriendlyPromotions::Promotion.human_attribute_name(:usage) %></th>
<th><%= SolidusFriendlyPromotions::Promotion.human_attribute_name(:starts_at) %></th>
<th><%= SolidusFriendlyPromotions::Promotion.human_attribute_name(:expires_at) %></th>
<th><%= sort_link @search, :starts_at %></th>
<th><%= sort_link @search, :expires_at %></th>
<th><%= SolidusFriendlyPromotions::Promotion.human_attribute_name(:lane) %></th>
<th class="actions"></th>
</tr>
Expand Down

0 comments on commit 6fd6acc

Please sign in to comment.