You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
37 lines
1.1 KiB
import ApplicationController from './application_controller' |
|
|
|
export default class extends ApplicationController { |
|
connect() { |
|
super.connect() |
|
|
|
var default_opts = { |
|
plugins: ['restore_on_backspace', 'remove_button'], |
|
searchField: ['text', 'optgroup'], |
|
valueField: "id", |
|
allowEmptyOption: false, |
|
showEmptyOptionInDropdown: true, |
|
emptyOptionLabel: true, |
|
hideSelected: true, |
|
placeholder: "Please Select" |
|
} |
|
|
|
$(".default-selectize").selectize(default_opts) |
|
|
|
var $doctrine_content = $("#doctrineModal").find("input[name='content']") |
|
var $trix_content = $("#doctrineModal").find(".trix-content") |
|
|
|
var doctrine_content_suggestions_opts = { |
|
onChange: function (value) { |
|
if(value === null || value === undefined || value === "") { |
|
$doctrine_content.val("") |
|
$trix_content.val("") |
|
} else { |
|
$doctrine_content.val(value) |
|
$trix_content.val(value) |
|
} |
|
} |
|
}; |
|
|
|
$("#doctine_content_suggestions").selectize($.extend(doctrine_content_suggestions_opts, default_opts)) |
|
} |
|
}
|
|
|