collapsable filter div

This commit is contained in:
Ilion Beyst 2015-09-11 20:46:37 +02:00
parent 60b7a14a5d
commit a87f00ddbc
3 changed files with 32 additions and 11 deletions

View file

@ -4,6 +4,7 @@ ready = function() {
errors = $("#transaction_errors") errors = $("#transaction_errors")
panel_ul = $(errors).find(".panel-body ul") panel_ul = $(errors).find(".panel-body ul")
flash_success = $("#transaction_success") flash_success = $("#transaction_success")
var table = $('#transactions').DataTable({ var table = $('#transactions').DataTable({
processing: true, processing: true,
serverSide: true, serverSide: true,
@ -60,6 +61,14 @@ ready = function() {
}); });
}); });
// filters
filters = $("#transactions-filters");
filters_body = filters.find(".panel-body");
filters.find(".panel-heading").click( function() {
filters_body.slideToggle();
});
filters_body.hide();
$(form).on("ajax:before", function(xhr, settings) { $(form).on("ajax:before", function(xhr, settings) {
$(flash_success).addClass("hidden") $(flash_success).addClass("hidden")
$(submit_button).val("Processing") $(submit_button).val("Processing")

View file

@ -30,7 +30,10 @@ table.pure-table-striped {
} }
} }
.data-table-filters { #transactions-filters {
.panel-heading {
cursor: pointer;
}
.row { .row {
padding: 10px; padding: 10px;
padding-top: 20px; padding-top: 20px;

View file

@ -2,46 +2,55 @@
= render 'transactions/new' = render 'transactions/new'
.panel.panel-default.data-table-filters #transactions-filters.panel.panel-default
.panel-heading .panel-heading
%h3.panel-title Filters %h3.panel-title Filters
.panel-body .panel-body
.row .row
.col-md-8.col-md-offset-2 .col-md-8.col-md-offset-2
.bound.input-listen{ 'data-input-type': 'date-range', 'data-filter-name': 'Time' } .bound.input-listen{ 'data-input-type': 'date-range',
'data-filter-name': 'Time' }
.row .row
.col-md-6 .col-md-6
.input-group .input-group
%span.input-group-addon %span.input-group-addon
%span.glyphicon.glyphicon-calendar %span.glyphicon.glyphicon-calendar
%input.lower-bound.form-control.filter-align{type: 'date', placeholder: 'After', class: 'pure-group-addon'} %input.lower-bound.form-control.filter-align{type: 'date',
placeholder: 'After', class: 'pure-group-addon'}
.col-md-6 .col-md-6
.input-group .input-group
%span.input-group-addon %span.input-group-addon
%span.glyphicon.glyphicon-calendar %span.glyphicon.glyphicon-calendar
%input.upper-bound.form-control.filter-align{type: 'date', placeholder: 'Before', class: 'pure-group-addon'} %input.upper-bound.form-control.filter-align{type: 'date',
.bound.input-listen.pure-u-1{ 'data-input-type': 'number-range', 'data-filter-name': 'Amount' } placeholder: 'Before', class: 'pure-group-addon'}
.bound.input-listen.pure-u-1{ 'data-input-type': 'number-range',
'data-filter-name': 'Amount' }
.row .row
.col-md-6 .col-md-6
.input-group .input-group
%span.input-group-addon %span.input-group-addon
%span.glyphicon.glyphicon-euro %span.glyphicon.glyphicon-euro
%input.lower-bound.form-control.filter-align{type: 'number', placeholder: 'Minimum'} %input.lower-bound.form-control.filter-align{type: 'number',
placeholder: 'Minimum'}
.col-md-6 .col-md-6
.input-group .input-group
%span.input-group-addon %span.input-group-addon
%span.glyphicon.glyphicon-euro %span.glyphicon.glyphicon-euro
%input.upper-bound.form-control.filter-align{type: 'number', placeholder: 'Maximum'} %input.upper-bound.form-control.filter-align{type: 'number',
placeholder: 'Maximum'}
.row .row
.col-md-4 .col-md-4
.input-listen{ 'data-input-type': 'text', 'data-filter-name': 'Issuer' } .input-listen{ 'data-input-type': 'text', 'data-filter-name': 'Issuer' }
%input{type: 'text', placeholder: 'Filter on Issuer', class: "form-control" } %input{type: 'text', placeholder: 'Filter on Issuer',
class: "form-control" }
.col-md-4 .col-md-4
.input-listen{ 'data-input-type': 'text', 'data-filter-name': 'Peer' } .input-listen{ 'data-input-type': 'text', 'data-filter-name': 'Peer' }
%input{type: 'text', placeholder: 'Filter on Peer', class: "form-control" } %input{type: 'text', placeholder: 'Filter on Peer',
class: "form-control" }
.col-md-4 .col-md-4
.input-listen{ 'data-input-type': 'text', 'data-filter-name': 'Message' } .input-listen{ 'data-input-type': 'text', 'data-filter-name': 'Message' }
%input{type: 'text', placeholder: 'Filter on Message', class: "form-control" } %input{type: 'text', placeholder: 'Filter on Message',
class: "form-control" }
%table#transactions.pure-table.pure-table-striped{data: { source: user_path(@user) }} %table#transactions.pure-table.pure-table-striped{data: { source: user_path(@user) }}
%thead %thead