hide dialogs on input focus
authorcavaliet
Tue, 17 Sep 2013 16:58:08 +0200
changeset 96 d2c4dbdf3548
parent 95 594f79a5706b
child 97 12bbec897e48
hide dialogs on input focus
src/p4l/static/p4l/js/semantictree.js
--- a/src/p4l/static/p4l/js/semantictree.js	Tue Sep 17 16:11:13 2013 +0200
+++ b/src/p4l/static/p4l/js/semantictree.js	Tue Sep 17 16:58:08 2013 +0200
@@ -44,7 +44,7 @@
             angular.element(this).controller('ngModel').$setViewValue(uri);
         },
         minLength: 2
-    });  
+    });
 }
 
 
@@ -258,4 +258,11 @@
     init_autocomplete();
     init_browse();
     init_tagit_autocomplete();
+    // Close dialogs on click/focus. focus can not be listened because of obvious loop problem.
+    $(document).on('click', '.semantic-tree', function() {
+    	$(".dialog").dialog("close");
+    	if(!$(this).is(":focus")){
+    		$(this).focus();
+    	}
+    });
 });
\ No newline at end of file