# HG changeset patch # User luisf # Date 1368464558 -3600 # Node ID 8d30e7644b754ee7307bbd6e6edf2038c564bd35 # Parent e9bfba17e791b46719b9a40eca0b8af1a565b325 fixed a few routes (using GET instead of POST ). Simplified JS code. diff -r e9bfba17e791 -r 8d30e7644b75 plugins/redmine_bibliography/assets/javascripts/authors.js --- 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"){ diff -r e9bfba17e791 -r 8d30e7644b75 plugins/redmine_bibliography/assets/javascripts/bibliography.js --- 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() diff -r e9bfba17e791 -r 8d30e7644b75 plugins/redmine_bibliography/config/routes.rb --- 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