changeset 596:fcff84e1c1ce feature_36

In the remote call now only passing the id of the form's object, instead of the complete name of the object.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Tue, 16 Aug 2011 11:47:30 +0100
parents 84e8d34d024c
children 70f0276fde9a
files vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml
diffstat 3 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Tue Aug 16 02:06:36 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Tue Aug 16 11:47:30 2011 +0100
@@ -203,7 +203,9 @@
     
     @results = []
     
-    @object_name = params[:object_name]
+    object_id = params[:object_id]
+    @object_name = "publications[authorships_attributes][#{object_id}]"
+    
     
     logger.error { "OBJECT NAME #{@object_name}" }
     
--- a/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb	Tue Aug 16 02:06:36 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb	Tue Aug 16 11:47:30 2011 +0100
@@ -95,6 +95,11 @@
     str.to_sym
   end
   
+  def form_object_id(object_name)
+    str = object_name.split("\[").last().gsub("\]","")
+    str.to_sym
+  end
+  
   def render_projects_list(publication)
     logger.error { "PROJECT NAME #{@project.name unless @project.nil?}" }
     
--- a/vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml	Tue Aug 16 02:06:36 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml	Tue Aug 16 11:47:30 2011 +0100
@@ -5,7 +5,7 @@
   <p>
 	<%= f.text_field :search_name, :size => 25 %>
 	
-	<%= observe_field( form_tag_id(f.object_name, :search_name), :frequency => 0.5, :update => form_tag_id( f.object_name, :identify_author_results), :url => { :controller => 'publications', :action => 'autocomplete_for_author', :object_name => f.object_name },  :with => 'q' ) %>
+	<%= observe_field( form_tag_id(f.object_name, :search_name), :frequency => 0.5, :update => form_tag_id( f.object_name, :identify_author_results), :url => { :controller => 'publications', :action => 'autocomplete_for_author', :object_name => form_object_id(f.object_name)  },  :with => 'q' ) %>
 	 
 	<%= link_to_function l(:label_author_is_me), "update_author_info(this," + User.current.get_author_info.to_json + ")", :id => "add_me_as_author" %>
 	<br />
@@ -17,10 +17,12 @@
 		<p id="<%= form_tag_id( f.object_name, :identify_author_results ) %>">
 		</p>
 
-			<%= f.radio_button :add_this_author, false %>
-			<%= f.radio_button :add_this_author, false %>
-			<%= f.radio_button :add_this_author, true %>
+<p>
+			    <label><%= f.radio_button :add_this_author, false %><%= l(:field_identify_author_yes) %></label><br />
+			    <label><%= f.radio_button :add_this_author, false %><%= l(:field_identify_author_correct) %></label><br />
+			    <label><%= f.radio_button :add_this_author, false %><%= l(:field_identify_author_no) %></label><br />
 
+</p>
 		
     </div>	
   </p>