mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-16 05:04:03 +00:00
Fix selectized users on booth/proposal forms
This commit is contained in:
parent
7e5175536e
commit
0ff503bc1b
6 changed files with 57 additions and 71 deletions
30
app/views/shared/_user_selectize.html.haml
Normal file
30
app/views/shared/_user_selectize.html.haml
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
:javascript
|
||||
$(document).ready(function() {
|
||||
$('#users_selectize').selectize({
|
||||
persist: false,
|
||||
create: false,
|
||||
valueField: 'id',
|
||||
labelField: 'username',
|
||||
searchField: 'username',
|
||||
load: function(query, callback) {
|
||||
if (!query.length) return callback();
|
||||
$.ajax({
|
||||
url: "#{search_users_path}.json",
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
query: query,
|
||||
},
|
||||
error: function(res) {
|
||||
console.log("selectize error");
|
||||
callback();
|
||||
},
|
||||
success: function(res) {
|
||||
console.log("selectize success");
|
||||
// console.log(res);
|
||||
callback(res.users);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue