diff plugins/redmine_bibliography/assets/javascripts/authors.js @ 1281:e9bfba17e791 redmine-2.2-integration

changes to the authors search ajax (not finished).
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Fri, 10 May 2013 17:59:12 +0100
parents f8bb7ccc6fac
children 8d30e7644b75
line wrap: on
line diff
--- a/plugins/redmine_bibliography/assets/javascripts/authors.js	Fri May 10 17:50:56 2013 +0100
+++ b/plugins/redmine_bibliography/assets/javascripts/authors.js	Fri May 10 17:59:12 2013 +0100
@@ -14,6 +14,30 @@
   $(link).closest(".fields").hide();
 }
 
+$(".author_search").live('keyup.autocomplete', function(){
+    $this = $(this);
+
+    $.ajax({
+        type: "POST",
+        url: "/publications/autocomplete_for_author",
+        dataType: "json",
+        data: {
+            q: $this.val()
+        },
+
+        success: function(data, type) {
+            console.log("OK: " + data);
+            items = data;
+            response(items);
+        },
+
+        error: function(data, type){
+            console.log("ERROR: " + type);
+        }
+    });
+});
+
+
 function identify_author_status(status, object_id) {
     $('publication_authorships_attributes_' + object_id + '_edit_author_info').select('input').each(function(s) {
 	if(status == "no"){