Form: add select2 form multiple select
This commit is contained in:
parent
e0bd42032a
commit
509b378567
5 changed files with 34 additions and 2 deletions
|
@ -17,4 +17,5 @@
|
||||||
//= require leaflet.1.1.0
|
//= require leaflet.1.1.0
|
||||||
//= require highcharts
|
//= require highcharts
|
||||||
//= require chartkick
|
//= require chartkick
|
||||||
|
//= require select2
|
||||||
//= require_tree .
|
//= require_tree .
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
document.addEventListener('turbolinks:load', function() {
|
||||||
|
$('select.select2').select2();
|
||||||
|
});
|
|
@ -58,7 +58,8 @@
|
||||||
max-width: 180px;
|
max-width: 180px;
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select,
|
||||||
|
.select2-selection {
|
||||||
// hack found here: https://stackoverflow.com/questions/1895476/how-to-style-a-select-dropdown-with-css-only-without-javascript
|
// hack found here: https://stackoverflow.com/questions/1895476/how-to-style-a-select-dropdown-with-css-only-without-javascript
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
-moz-appearance: none;
|
-moz-appearance: none;
|
||||||
|
@ -81,6 +82,31 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.select2 {
|
||||||
|
min-width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 2 * $default-padding;
|
||||||
|
|
||||||
|
&.select2-container--focus {
|
||||||
|
.select2-selection {
|
||||||
|
border-color: $border-grey;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// scss-lint:disable SelectorFormat
|
||||||
|
.select2-selection__rendered {
|
||||||
|
padding: $default-padding;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-selection__choice {
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
}
|
||||||
|
// scss-lint:enable
|
||||||
|
}
|
||||||
|
|
||||||
.datetime {
|
.datetime {
|
||||||
input[type=date] {
|
input[type=date] {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
|
@ -4,4 +4,5 @@
|
||||||
// = require ./utils
|
// = require ./utils
|
||||||
// = require ./fonts
|
// = require ./fonts
|
||||||
// = require leaflet.1.1.0
|
// = require leaflet.1.1.0
|
||||||
|
// = require select2
|
||||||
// = require_tree .
|
// = require_tree .
|
||||||
|
|
|
@ -5,4 +5,5 @@
|
||||||
options_for_select(champ.drop_down_list.options,
|
options_for_select(champ.drop_down_list.options,
|
||||||
selected: champ.drop_down_list.selected_options_without_decorator(champ),
|
selected: champ.drop_down_list.selected_options_without_decorator(champ),
|
||||||
disabled: champ.drop_down_list.disabled_options),
|
disabled: champ.drop_down_list.disabled_options),
|
||||||
multiple: true)
|
multiple: true,
|
||||||
|
class: 'select2')
|
||||||
|
|
Loading…
Reference in a new issue