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,11 +21,14 @@
//= require_tree .
ready = function() {
$(".select2-selector").select2({
$.each($(".select2-selector"), function(index, val) {
$(val).select2({
width: 'resolve',
placeholder: "Ontvanger"
placeholder: $(".select2-selector")
});
}
)
}
$(document).ready(ready)
$(document).on('page:load', ready)

View file

@ -7,7 +7,7 @@
= f.select :creditor,
options_from_collection_for_select(User.all.order(:name), :name, :name),
{ 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
.input-group
%span.input-group-addon

View file

@ -35,7 +35,9 @@
.row
.col-md-4
.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
.input-listen{ 'data-input-type': 'text', 'data-filter-name': 'Peer' }
%input{type: 'text', placeholder: 'Filter on Peer', class: "form-control" }