Story#112050051 - fix invoice sorting in admin

This commit is contained in:
Vladimir Krylov 2016-02-04 15:54:58 +02:00
parent 98298d9258
commit 0ce6b84ddf
2 changed files with 5 additions and 5 deletions

View file

@ -23,7 +23,7 @@ class Admin::InvoicesController < AdminController
def index def index
@q = Invoice.includes(:account_activity).search(params[:q]) @q = Invoice.includes(:account_activity).search(params[:q])
@q.sorts = 'id desc' if @q.sorts.empty? @q.sorts = 'number desc' if @q.sorts.empty?
@invoices = @q.result.page(params[:page]) @invoices = @q.result.page(params[:page])
end end

View file

@ -8,13 +8,13 @@
%thead %thead
%tr %tr
%th{class: 'col-xs-3'} %th{class: 'col-xs-3'}
= sort_link(@q, 'invoice') = sort_link(@q, :number)
%th{class: 'col-xs-3'} %th{class: 'col-xs-3'}
= sort_link(@q, 'buyer') = sort_link(@q, :buyer_name, "Buyer")
%th{class: 'col-xs-3'} %th{class: 'col-xs-3'}
= sort_link(@q, 'due_date') = sort_link(@q, :due_date)
%th{class: 'col-xs-3'} %th{class: 'col-xs-3'}
= sort_link(@q, 'receipt_date') = sort_link(@q, :account_activity_created_at, "Receipt date")
%tbody %tbody
- @invoices.each do |x| - @invoices.each do |x|
%tr %tr