2015-09-08 19:39:13 +02:00
|
|
|
%h2= @user.name
|
2015-09-09 20:54:16 +02:00
|
|
|
|
2015-09-09 21:26:19 +02:00
|
|
|
%table#transactions.pure-table.pure-table-striped{data: { source: user_path(@user) }}
|
2015-09-08 19:39:13 +02:00
|
|
|
%thead
|
|
|
|
%tr
|
2015-09-09 20:00:47 +02:00
|
|
|
%th Time
|
2015-09-08 19:39:13 +02:00
|
|
|
%th Amount
|
2015-09-09 20:00:47 +02:00
|
|
|
%th Peer
|
2015-09-09 18:17:55 +02:00
|
|
|
%th Issuer
|
2015-09-08 19:39:13 +02:00
|
|
|
%th Message
|
2015-09-09 20:54:16 +02:00
|
|
|
%tbody
|
|
|
|
%tfoot
|
2015-09-09 17:14:06 +02:00
|
|
|
%tr
|
2015-09-09 20:18:30 +02:00
|
|
|
%td.bound.input-listen{ 'data-input-type': 'date-range' }
|
2015-09-09 20:00:47 +02:00
|
|
|
%input.lower-bound{type: 'date', placeholder: 'after'}
|
|
|
|
= "<= Time <="
|
|
|
|
%input.upper-bound{type: 'date', placeholder: 'before'}
|
2015-09-09 20:18:30 +02:00
|
|
|
%td.bound.input-listen{ 'data-input-type': 'number-range' }
|
2015-09-09 17:14:06 +02:00
|
|
|
%input.lower-bound{type: 'number', placeholder: 'lower', class: 'pure-u-1-5'}
|
|
|
|
= "<= Amount <="
|
|
|
|
%input.upper-bound{type: 'number', placeholder: 'upper', class: 'pure-u-1-5'}
|
2015-09-09 20:18:30 +02:00
|
|
|
%td.input-listen{ 'data-input-type': 'text' }
|
2015-09-09 18:17:55 +02:00
|
|
|
%input{type: 'text', placeholder: 'Filter on Issuer'}
|
2015-09-09 20:18:30 +02:00
|
|
|
%td.input-listen{ 'data-input-type': 'text' }
|
|
|
|
%input{type: 'text', placeholder: 'Filter on Peer'}
|
|
|
|
%td.input-listen{ 'data-input-type': 'text' }
|
2015-09-09 17:14:06 +02:00
|
|
|
%input{type: 'text', placeholder: 'Filter on Message'}
|
2015-09-08 20:45:32 +02:00
|
|
|
|
|
|
|
:javascript
|
|
|
|
$(document).ready(function() {
|
2015-09-09 17:14:06 +02:00
|
|
|
var table = $('#transactions').DataTable({
|
2015-09-09 14:46:06 +02:00
|
|
|
processing: true,
|
|
|
|
serverSide: true,
|
2015-09-09 21:26:19 +02:00
|
|
|
searching: false,
|
|
|
|
lengthChange: false,
|
2015-09-09 14:46:06 +02:00
|
|
|
ordering: false,
|
|
|
|
ajax: $('#transactions').data('source'),
|
|
|
|
pagingType: 'full_numbers',
|
2015-09-09 20:00:47 +02:00
|
|
|
autoWidth: false,
|
2015-09-09 20:54:16 +02:00
|
|
|
responsive: true,
|
2015-09-09 14:46:06 +02:00
|
|
|
columns: [
|
2015-09-09 20:54:16 +02:00
|
|
|
{ data: 'time', name: 'Time', className: 'min-tablet-l'},
|
|
|
|
{ data: 'amount', name: 'Amount', className: 'min-mobile'},
|
|
|
|
{ data: 'peer', name: 'Peer', className: 'min-mobile'},
|
|
|
|
{ data: 'issuer', name: 'Issuer', className: 'min-desktop'},
|
|
|
|
{ data: 'message', name: 'Message', className: 'min-tablet-p'},
|
2015-09-09 20:00:47 +02:00
|
|
|
]
|
2015-09-09 17:14:06 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
var tds = $('.input-listen');
|
|
|
|
var i = 0;
|
|
|
|
table.columns().every(function() {
|
|
|
|
var column = this
|
|
|
|
tds.eq(i).find('input').on('keyup change', function() {
|
|
|
|
var value = null;
|
|
|
|
var td = $(this).parent();
|
|
|
|
if(td.hasClass('bound')) {
|
|
|
|
value = td.find('.lower-bound').val() + '~' + td.find('.upper-bound').val();
|
|
|
|
} else {
|
|
|
|
value = $(this).val()
|
|
|
|
}
|
2015-09-09 20:18:30 +02:00
|
|
|
value = td.attr('data-input-type') + ':' + value
|
2015-09-09 17:14:06 +02:00
|
|
|
if(column.search() !== value) {
|
|
|
|
column.search(value).draw();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
i = i + 1;
|
2015-09-09 14:46:06 +02:00
|
|
|
});
|
2015-09-08 20:45:32 +02:00
|
|
|
});
|