# HG changeset patch # User luisf # Date 1313421480 -3600 # Node ID 7234e0a90c628625675a51b2a73702109b6979b6 # Parent 68c6b060385ce2b1c90cc6a1ce07aa9664961193 More Author/User changes. Not stable. diff -r 68c6b060385c -r 7234e0a90c62 vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb --- 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 diff -r 68c6b060385c -r 7234e0a90c62 vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb --- 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 = "No Authors found that match your search… sorry!" - 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 = "No Authors found that match your search… sorry!" +# end end diff -r 68c6b060385c -r 7234e0a90c62 vendor/plugins/redmine_bibliography/app/models/authorship.rb --- 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| diff -r 68c6b060385c -r 7234e0a90c62 vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml --- 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 @@

<%= 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" %>
@@ -14,9 +14,14 @@

- <%= 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 %> + +

diff -r 68c6b060385c -r 7234e0a90c62 vendor/plugins/redmine_bibliography/app/views/publications/autocomplete_for_author.rhtml --- 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 %>