changeset 594:7234e0a90c62 feature_36

More Author/User changes. Not stable.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Mon, 15 Aug 2011 16:18:00 +0100
parents 68c6b060385c
children 84e8d34d024c
files vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb vendor/plugins/redmine_bibliography/app/models/authorship.rb vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml vendor/plugins/redmine_bibliography/app/views/publications/autocomplete_for_author.rhtml
diffstat 5 files changed, 25 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Mon Aug 15 13:55:01 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Mon Aug 15 16:18:00 2011 +0100
@@ -20,9 +20,9 @@
     
     @project_id = params[:project_id]
     @current_user = User.current    
-    
-    @options = []
-    @results = []
+
+    @author_options = []
+
   end
 
 
--- a/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb	Mon Aug 15 13:55:01 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb	Mon Aug 15 16:18:00 2011 +0100
@@ -78,22 +78,20 @@
       end
     end
     
-    @options = []
+    
+    
+    @author_options = []
     @results.each do |result|
-      @options << ["#{result.name} (#{result.mail})", "#{result.class.to_s}_#{result.id.to_s}"]
+      @author_options << ["#{result.name} (#{result.mail})", "#{result.class.to_s}_#{result.id.to_s}"]
     end
     
-    if @results.size > 0
-      s = select_tag('country', options_for_select(@options), :size => 3) 
-      s << observe_field( 'country', :on => 'click', :function => "alert('Element changed')", :with => 'q')
-      
-      s << radio_button_tag("publication[authorship_attributes]", "category", "rails")
-      s << radio_button_tag("post", "category", "java")
-      s << radio_button_tag("post", "category", "java")
-      
-    else
-      s = "<em>No Authors found that match your search… sorry!</em>"
-    end
+#   if @results.size > 0
+#     s = select('country', options_for_select(@options), :size => 3) 
+#     s << observe_field( 'country', :on => 'click', :function => "alert('Element changed')", :with => 'q')
+#     
+#   else
+#     s = "<em>No Authors found that match your search… sorry!</em>"
+#   end
       
   end
 
--- a/vendor/plugins/redmine_bibliography/app/models/authorship.rb	Mon Aug 15 13:55:01 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/models/authorship.rb	Mon Aug 15 16:18:00 2011 +0100
@@ -7,7 +7,7 @@
   accepts_nested_attributes_for :author
   accepts_nested_attributes_for :publication
   
-  attr_accessor :is_user, :author_user_id, :search_name, :add_this_author, :correct_author_info, :ignore_author
+  attr_accessor :is_user, :author_user_id, :search_name, :add_this_author, :search_results
   before_save :associate_author_user
 
   named_scope :like, lambda {|q| 
--- a/vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml	Mon Aug 15 13:55:01 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml	Mon Aug 15 16:18:00 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), :url => { :controller => 'publications', :action => 'autocomplete_for_author' }, :with => 'q') %>
+	<%= observe_field( form_tag_id(f.object_name, :search_name), :frequency => 0.5, :url => { :controller => 'publications', :action => 'autocomplete_for_author' }, :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 />
@@ -14,9 +14,14 @@
 
   <p>
     <div id="<%= form_tag_id( f.object_name, :identify_author ) %>">		
-		<%= f.radio_button :add_this_author, false %>
-		<%= f.radio_button :add_this_author, false %>
-		<%= f.radio_button :add_this_author, true %>
+
+			<%= f.select :search_results, options_for_select(@author_options), :size => 3 %>
+
+			<%= f.radio_button :add_this_author, false %>
+			<%= f.radio_button :add_this_author, false %>
+			<%= f.radio_button :add_this_author, true %>
+
+		
     </div>	
   </p>
 
--- a/vendor/plugins/redmine_bibliography/app/views/publications/autocomplete_for_author.rhtml	Mon Aug 15 13:55:01 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/autocomplete_for_author.rhtml	Mon Aug 15 16:18:00 2011 +0100
@@ -1,4 +1,4 @@
 <% if params[:q] && params[:q].length > 1 %>
-	<%= choose_author_link @results %>
+	<% choose_author_link @results %>
 <% end %>