mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Added default sort #2741
This commit is contained in:
parent
3d43c53c9d
commit
f43c6bbf98
2 changed files with 4 additions and 3 deletions
|
@ -4,6 +4,7 @@ class Admin::PricelistsController < AdminController
|
|||
|
||||
def index
|
||||
@q = Pricelist.search(params[:q])
|
||||
@q.sorts = ['category asc', 'duration asc', 'operation_category asc', 'valid_from desc'] if @q.sorts.empty?
|
||||
@pricelists = @q.result.page(params[:page])
|
||||
end
|
||||
|
||||
|
|
|
@ -14,10 +14,10 @@
|
|||
%tr
|
||||
%th{class: 'col-xs-2'}
|
||||
= sort_link(@q, 'category', t(:category))
|
||||
%th{class: 'col-xs-2'}
|
||||
= sort_link(@q, 'operation_category', t(:operation))
|
||||
%th{class: 'col-xs-2'}
|
||||
= sort_link(@q, 'duration', t(:duration))
|
||||
%th{class: 'col-xs-2'}
|
||||
= sort_link(@q, 'operation_category', t(:operation))
|
||||
%th{class: 'col-xs-2'}
|
||||
= sort_link(@q, 'price', t(:price))
|
||||
%th{class: 'col-xs-2'}
|
||||
|
@ -31,8 +31,8 @@
|
|||
- @pricelists.each do |pricelist|
|
||||
%tr
|
||||
%td= pricelist.category
|
||||
%td= pricelist.operation_category
|
||||
%td= pricelist.duration
|
||||
%td= pricelist.operation_category
|
||||
%td= pricelist.price
|
||||
%td= l(pricelist.valid_from, format: :ydate)
|
||||
%td= l(pricelist.valid_to, format: :ydate)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue