auto complete box for hosts.
This commit is contained in:
parent
ace30e9766
commit
3d952eb1bd
4 changed files with 32 additions and 7 deletions
|
@ -131,14 +131,20 @@ function schedulePlaylist() {
|
|||
|
||||
}
|
||||
|
||||
function makeShowDialog(html) {
|
||||
function autoSelect(event, ui) {
|
||||
|
||||
$("#hosts-"+ui.item.value).attr("checked", "checked");
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
function makeShowDialog(json) {
|
||||
|
||||
var dialog;
|
||||
|
||||
//main jqueryUI dialog
|
||||
dialog = $('<div id="schedule_add_event_dialog" />');
|
||||
|
||||
dialog.append(html);
|
||||
dialog.append(json.form);
|
||||
|
||||
var start = dialog.find("#start_date");
|
||||
var end = dialog.find("#end_date");
|
||||
|
@ -146,6 +152,16 @@ function makeShowDialog(html) {
|
|||
createDateInput(start, startDpSelect);
|
||||
createDateInput(end, endDpSelect);
|
||||
|
||||
var auto = json.hosts.map(function(el) {
|
||||
return {value: el.id, label: el.login};
|
||||
});
|
||||
|
||||
dialog.find("#hosts_autocomplete").autocomplete({
|
||||
source: auto,
|
||||
select: autoSelect
|
||||
});
|
||||
|
||||
|
||||
dialog.dialog({
|
||||
autoOpen: false,
|
||||
title: 'Add Show',
|
||||
|
@ -203,7 +219,7 @@ function openShowDialog() {
|
|||
url = '/Schedule/add-show-dialog/format/json';
|
||||
|
||||
$.get(url, function(json){
|
||||
var dialog = makeShowDialog(json.form);
|
||||
var dialog = makeShowDialog(json);
|
||||
dialog.dialog('open');
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue