Autocompleter fixes and application keybindings

feature/core
Sven Slootweg 11 years ago
parent 3a3aeb9ad3
commit 228f6dc3d2

@ -61,7 +61,7 @@ AutoCompleterInstance.prototype._handleKeyUp = function(event) {
{
case 9: // Tab
case 13: // Enter/Return
if(this.visible == true)
if(this.visible == true && this.total_items > 0)
{
this._selectCurrent();
event.stopPropagation();
@ -77,7 +77,7 @@ AutoCompleterInstance.prototype._handleKeyDown = function(event) {
case 9: // Tab
case 13: // Enter/Return
/* We don't want this to do anything. */
if(this.visible == true)
if(this.visible == true && this.total_items > 0)
{
event.stopPropagation();
event.preventDefault();

@ -67,6 +67,7 @@ function JsdeWindow(options)
}
this.loading = true;
this.loaded_callback = options.callback;
var container = this;
@ -76,6 +77,10 @@ function JsdeWindow(options)
success: function(response){
container.SetContents(response.contents);
container.loading = false;
if(typeof container.loaded_callback !== "undefined")
{
container.loaded_callback();
}
},
data: options.source_data,
dataType: "json"

@ -216,7 +216,7 @@ $(function(){
hookSubmitEvent($("#form_search"));
$("#button_toolbar_addnode").click(function(){
new JsdeWindow({
var win = new JsdeWindow({
width: 320,
height: 400,
x: 40,
@ -224,6 +224,7 @@ $(function(){
title: "Create new node",
contents: "Loading...",
source_url: "/nodes/create",
callback: function(){ $(win._inner).find("input[name=name]").focus(); },
noscroll: true
});
});
@ -258,4 +259,24 @@ $(function(){
openWindowNodeDetails(data.value);
this.target.val("");
});
$("body").keydown(function(event){
switch(event.which)
{
case 70: // F
if(event.ctrlKey)
{
$("#input_search_query").focus();
event.preventDefault();
}
break;
case 77: // M
if(event.ctrlKey)
{
$("#button_toolbar_addnode").click();
event.preventDefault();
}
break;
}
});
});

Loading…
Cancel
Save