changeset 1282:8d30e7644b75 redmine-2.2-integration

fixed a few routes (using GET instead of POST ). Simplified JS code.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Mon, 13 May 2013 18:02:38 +0100
parents e9bfba17e791
children 006057cf8f16
files plugins/redmine_bibliography/assets/javascripts/authors.js plugins/redmine_bibliography/assets/javascripts/bibliography.js plugins/redmine_bibliography/config/routes.rb
diffstat 3 files changed, 7 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/redmine_bibliography/assets/javascripts/authors.js	Fri May 10 17:59:12 2013 +0100
+++ b/plugins/redmine_bibliography/assets/javascripts/authors.js	Mon May 13 18:02:38 2013 +0100
@@ -15,29 +15,12 @@
 }
 
 $(".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);
-        }
+     $(this).autocomplete({
+        source: '/publications/autocomplete_for_author',
+        minLength: 2
     });
 });
 
-
 function identify_author_status(status, object_id) {
     $('publication_authorships_attributes_' + object_id + '_edit_author_info').select('input').each(function(s) {
 	if(status == "no"){
--- a/plugins/redmine_bibliography/assets/javascripts/bibliography.js	Fri May 10 17:59:12 2013 +0100
+++ b/plugins/redmine_bibliography/assets/javascripts/bibliography.js	Mon May 13 18:02:38 2013 +0100
@@ -3,7 +3,7 @@
     $this = $(this);
 
     $.ajax({
-        type: "POST",
+        type: "get",
         url: "/publications/show_bibtex_fields",
         data: {
             value: $this.val()
--- a/plugins/redmine_bibliography/config/routes.rb	Fri May 10 17:59:12 2013 +0100
+++ b/plugins/redmine_bibliography/config/routes.rb	Mon May 13 18:02:38 2013 +0100
@@ -1,7 +1,7 @@
 RedmineApp::Application.routes.draw do
-  resources :publications
+    match "publications/show_bibtex_fields", :to => 'publications#show_bibtex_fields', :via => "get"
 
-  match "publications/show_bibtex_fields", :to => 'publications#show_bibtex_fields'
-  match "publications/autocomplete_for_author", :to => 'publications#autocomplete_for_author'
+    match "publications/autocomplete_for_author", :to => 'publications#autocomplete_for_author', :via => "get"
 
+    resources :publications
 end
\ No newline at end of file