change table order

This commit is contained in:
Felix Van der Jeugt 2015-09-09 20:00:47 +02:00
parent 4173275e96
commit c1d4b1c649
2 changed files with 14 additions and 14 deletions

View file

@ -31,11 +31,11 @@ module DataTable
def selection_to_json(user, selection) def selection_to_json(user, selection)
{ data: selection.map { |transaction| { { data: selection.map { |transaction| {
time: transaction.created_at,
amount: transaction.signed_amount_for(user), amount: transaction.signed_amount_for(user),
peer: transaction.peer_of(user).try(:name),
issuer: transaction.issuer.name, issuer: transaction.issuer.name,
message: transaction.message, message: transaction.message,
peer: transaction.peer_of(user).try(:name),
time: transaction.created_at
} } } }
} }
end end

View file

@ -2,26 +2,26 @@
%table#transactions.display.responsive.no-wrap{data: { source: user_path(@user) }} %table#transactions.display.responsive.no-wrap{data: { source: user_path(@user) }}
%thead %thead
%tr %tr
%th Time
%th Amount %th Amount
%th Peer
%th Issuer %th Issuer
%th Message %th Message
%th Peer
%th Time
%tr %tr
%td.bound.input-listen
%input.lower-bound{type: 'date', placeholder: 'after'}
= "<= Time <="
%input.upper-bound{type: 'date', placeholder: 'before'}
%td.bound.input-listen %td.bound.input-listen
%input.lower-bound{type: 'number', placeholder: 'lower', class: 'pure-u-1-5'} %input.lower-bound{type: 'number', placeholder: 'lower', class: 'pure-u-1-5'}
= "<= Amount <=" = "<= Amount <="
%input.upper-bound{type: 'number', placeholder: 'upper', class: 'pure-u-1-5'} %input.upper-bound{type: 'number', placeholder: 'upper', class: 'pure-u-1-5'}
%td.input-listen
%input{type: 'text', placeholder: 'Filter on Peer'}
%td.input-listen %td.input-listen
%input{type: 'text', placeholder: 'Filter on Issuer'} %input{type: 'text', placeholder: 'Filter on Issuer'}
%td.input-listen %td.input-listen
%input{type: 'text', placeholder: 'Filter on Message'} %input{type: 'text', placeholder: 'Filter on Message'}
%td.input-listen
%input{type: 'text', placeholder: 'Filter on Peer'}
%td.bound.input-listen
%input.lower-bound{type: 'date', placeholder: 'after'}
= "<= Time <="
%input.upper-bound{type: 'date', placeholder: 'before'}
%tbody %tbody
:javascript :javascript
@ -33,14 +33,14 @@
ordering: false, ordering: false,
ajax: $('#transactions').data('source'), ajax: $('#transactions').data('source'),
pagingType: 'full_numbers', pagingType: 'full_numbers',
autoWidth: false,
columns: [ columns: [
{ data: 'time', name: 'Time' },
{ data: 'amount', name: 'Amount' }, { data: 'amount', name: 'Amount' },
{ data: 'peer', name: 'Peer' },
{ data: 'issuer', name: 'Issuer' }, { data: 'issuer', name: 'Issuer' },
{ data: 'message', name: 'Message' }, { data: 'message', name: 'Message' },
{ data: 'peer', name: 'Peer' }, ]
{ data: 'time', name: 'Time' }
],
autoWidth: false
}); });
var tds = $('.input-listen'); var tds = $('.input-listen');