diff plugins/redmine_bibliography/app/controllers/publications_controller.rb @ 1274:5ea1a213c7a5 redmine-2.2-integration

Removed Ajax calls taht are no longer working in Rails 3 and started migrating them; added a new javascript file - bibliography.js - to hold the new jquery js code; added the new show_bibtex_fields.js.erb file to replace the RJS code that was in the controller.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Thu, 09 May 2013 18:44:59 +0100
parents 29dd06e01be3
children 006057cf8f16
line wrap: on
line diff
--- a/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Thu May 09 11:49:03 2013 +0100
+++ b/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Thu May 09 18:44:59 2013 +0100
@@ -5,7 +5,8 @@
   unloadable
 
   model_object Publication
-  before_filter :find_model_object, :except => [:new, :create, :index, :get_bibtex_required_fields, :autocomplete_for_project, :add_author, :sort_author_order, :autocomplete_for_author, :get_user_info ]
+  # before_filter :find_model_object, :except => [:new, :create, :index, :show_bibtex_fields, :autocomplete_for_project, :add_author, :sort_author_order, :autocomplete_for_author, :get_user_info ]
+
   before_filter :find_project_by_project_id, :authorize, :only => [ :edit, :new, :update, :create ]
 
   def new
@@ -60,23 +61,17 @@
     end
   end
 
-  def get_bibtex_required_fields
+  def show_bibtex_fields
+    @fields = []
 
     unless params[:value].empty?
-      fields = BibtexEntryType.fields(params[:value])
+      @fields = BibtexEntryType.fields(params[:value])
     end
 
     respond_to do |format|
       format.js {
-        render(:update) {|page|
-          if params[:value].empty?
-            page << "hideOnLoad();"
-          else
-            page << "show_required_bibtex_fields(#{fields.to_json()});"
-          end
-        }
+        render :show_bibtex_fields
       }
-
     end
   end