2015-09-08 19:39:13 +02:00
|
|
|
%h2= @user.name
|
2015-09-09 20:54:16 +02:00
|
|
|
|
2015-09-10 21:12:03 +02:00
|
|
|
.panel.panel-default.data-table-filters
|
|
|
|
.panel-header
|
|
|
|
%h3.panel-title Filters
|
|
|
|
.panel-body
|
|
|
|
.pure-g
|
2015-09-11 10:24:29 +02:00
|
|
|
.bound.input-listen.pure-u-1{ 'data-input-type': 'date-range' }
|
2015-09-10 22:57:00 +02:00
|
|
|
%fieldset.pure-group-inline
|
|
|
|
%span.fa.fa-calendar.pure-group-addon
|
|
|
|
%input.lower-bound{type: 'date', placeholder: 'after'}
|
2015-09-10 21:44:43 +02:00
|
|
|
\-
|
2015-09-10 21:12:03 +02:00
|
|
|
%input.upper-bound{type: 'date', placeholder: 'before'}
|
|
|
|
.pure-g
|
2015-09-11 10:24:29 +02:00
|
|
|
.bound.input-listen.pure-u-1{ 'data-input-type': 'number-range' }
|
2015-09-10 22:39:35 +02:00
|
|
|
%fieldset.pure-group-inline
|
|
|
|
%span.icon-euro.pure-group-addon
|
|
|
|
%input.lower-bound.pure-group-addon{type: 'number', placeholder: 'Minimum'}
|
2015-09-10 21:44:43 +02:00
|
|
|
\-
|
2015-09-10 22:39:35 +02:00
|
|
|
%fieldset.pure-group-inline
|
|
|
|
%span.icon-euro.pure-group-addon
|
|
|
|
%input.upper-bound.pure-group-addon{type: 'number', placeholder: 'Maximum'}
|
2015-09-10 21:12:03 +02:00
|
|
|
.pure-g
|
2015-09-11 10:24:29 +02:00
|
|
|
.input-listen.pure-u-md-1-4{ 'data-input-type': 'text' }
|
2015-09-10 21:12:03 +02:00
|
|
|
%input{type: 'text', placeholder: 'Filter on Issuer'}
|
2015-09-11 10:24:29 +02:00
|
|
|
.input-listen.pure-u-md-1-4{ 'data-input-type': 'text' }
|
2015-09-10 21:12:03 +02:00
|
|
|
%input{type: 'text', placeholder: 'Filter on Peer'}
|
2015-09-11 10:24:29 +02:00
|
|
|
.input-listen.pure-u-md-1-2{ 'data-input-type': 'text' }
|
2015-09-10 21:12:03 +02:00
|
|
|
%input{type: 'text', placeholder: 'Filter on Message'}
|
|
|
|
|
|
|
|
|
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
|
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-10 21:12:03 +02:00
|
|
|
{ data: 'time', name: 'Time', width: "15%", className: 'min-tablet-l'},
|
|
|
|
{ data: 'amount', name: 'Amount', width: "10%", className: 'min-mobile'},
|
|
|
|
{ data: 'peer', name: 'Peer', width: "15%", className: 'min-mobile'},
|
|
|
|
{ data: 'issuer', name: 'Issuer', width: "15%", className: 'min-desktop'},
|
2015-09-11 09:59:31 +02:00
|
|
|
{ data: 'message', name: 'Message', width: "45%", className: 'min-tablet-p'}
|
2015-09-09 20:00:47 +02:00
|
|
|
]
|
2015-09-09 17:14:06 +02:00
|
|
|
});
|
|
|
|
|
2015-09-11 09:59:31 +02:00
|
|
|
$('.input-listen').each(function(index, element) {
|
|
|
|
var filter = $(element);
|
|
|
|
var type = filter.attr('data-input-type');
|
2015-09-11 10:24:29 +02:00
|
|
|
var column = table.column(index);
|
2015-09-11 09:59:31 +02:00
|
|
|
filter.find('input').on('keyup change', function() {
|
|
|
|
var value = null
|
|
|
|
if(filter.hasClass('bound')) {
|
|
|
|
var lower = filter.find('.lower-bound');
|
|
|
|
var upper = filter.find('.upper-bound');
|
|
|
|
value = type + ':' + lower.val() + '~' + upper.val();
|
2015-09-09 17:14:06 +02:00
|
|
|
} else {
|
2015-09-11 09:59:31 +02:00
|
|
|
value = type + ':' + $(this).val();
|
2015-09-09 17:14:06 +02:00
|
|
|
}
|
2015-09-11 10:24:29 +02:00
|
|
|
value = filter.attr('data-input-type') + ':' + value;
|
|
|
|
if(column.search() !== value) {
|
|
|
|
column.search(value).draw();
|
2015-09-09 17:14:06 +02:00
|
|
|
}
|
|
|
|
});
|
2015-09-09 14:46:06 +02:00
|
|
|
});
|
2015-09-08 20:45:32 +02:00
|
|
|
});
|