Select2 on filter options

This commit is contained in:
benji 2015-09-11 21:05:00 +02:00
parent 35ec93e161
commit c3ea6dd433
3 changed files with 11 additions and 6 deletions

View file

@ -21,10 +21,13 @@
//= require_tree . //= require_tree .
ready = function() { ready = function() {
$(".select2-selector").select2({ $.each($(".select2-selector"), function(index, val) {
width: 'resolve', $(val).select2({
placeholder: "Ontvanger" width: 'resolve',
}); placeholder: $(".select2-selector")
});
}
)
} }
$(document).ready(ready) $(document).ready(ready)

View file

@ -7,7 +7,7 @@
= f.select :creditor, = f.select :creditor,
options_from_collection_for_select(User.all.order(:name), :name, :name), options_from_collection_for_select(User.all.order(:name), :name, :name),
{ include_blank: true }, { include_blank: true },
{ class: 'select2-selector form-control', size: 50, required: true } { class: 'select2-selector', size: 50, required: true, data: { placeholder: "Creditor" } }
= f.text_field :message, placeholder: "Message", size: 75, class: "form-control", required: true = f.text_field :message, placeholder: "Message", size: 75, class: "form-control", required: true
.input-group .input-group
%span.input-group-addon %span.input-group-addon

View file

@ -35,7 +35,9 @@
.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" } = grouped_collection_select :nil, :nil, [User, Client], :all, :name, :name, :name,
{ include_blank: true },
{ data: { placeholder: "Filter on Issuer" }, class: "select2-selector 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" }