# HG changeset patch # User luisf # Date 1354539316 0 # Node ID e5b80648aaa591f9bcd547dc2f6a13b87ae0945d # Parent 5392783ea417b71a2b061ab85ba57ee14fdd2043 Creates independent sets of radio buttons for each author. diff -r 5392783ea417 -r e5b80648aaa5 vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb --- a/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb Fri Nov 30 17:39:34 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb Mon Dec 03 12:55:16 2012 +0000 @@ -152,17 +152,21 @@ s end - def display_suggested_author(author) - s = radio_button_tag("suggested", author.id, false) - # todo. maybe not a safe assumption? - s << author.authorships.first.name_on_paper + def create_author_suggestion_radio(radio_object, author) + s = radio_button_tag(radio_object, author.id, false) + # todo: returns first non empty name... + author.authorships.each do |auth| + unless auth.name_on_paper.nil? + s << auth.name_on_paper + break + end + end s << '
' s end - - def display_suggested_user(user) - s = radio_button_tag("suggested", user.id, false) + def create_user_suggestion_radio(radio_object, user) + s = radio_button_tag(radio_object, user.id, false) s << user.name s << '
' s diff -r 5392783ea417 -r e5b80648aaa5 vendor/plugins/redmine_bibliography/app/views/publications/_suggest_author.html.erb --- a/vendor/plugins/redmine_bibliography/app/views/publications/_suggest_author.html.erb Fri Nov 30 17:39:34 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_suggest_author.html.erb Mon Dec 03 12:55:16 2012 +0000 @@ -1,17 +1,15 @@ + +<% logger.error { "index #{index}//" } %> +

- Author: <%= h(author[0]) -%> + Suggestions for Author: <%= h(suggestions[0]) -%>
- Authors: + <%- suggestions[1][:authors].each do |auth| -%> + <%= create_author_suggestion_radio("author_#{index}", auth) -%> + <%- end -%>
- <%- author[1][:authors].each do |auth| -%> - <%= display_suggested_author(auth) %> - <%- end -%> - -
- Users: -
- <%- author[1][:users].each do |usr| -%> - <%= display_suggested_user(usr) %> + <%- suggestions[1][:users].each do |usr| -%> + <%= create_user_suggestion_radio("author_#{index}", usr) -%> <%- end -%>

diff -r 5392783ea417 -r e5b80648aaa5 vendor/plugins/redmine_bibliography/app/views/publications/parse_bibtex.rjs --- a/vendor/plugins/redmine_bibliography/app/views/publications/parse_bibtex.rjs Fri Nov 30 17:39:34 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/parse_bibtex.rjs Mon Dec 03 12:55:16 2012 +0000 @@ -2,13 +2,12 @@ page.insert_html :bottom, :ieee_prev, @ieee_prev page.insert_html :top, :content, '
Successfully Parsed BibTeX
' - @suggested_authors.each do |auth| - page.insert_html :bottom, :suggest_bibtex_authors, :partial => "suggest_author" , :locals => {:author => auth} + @suggested_authors.each_with_index do |auth, idx| + page.insert_html :bottom, :suggest_bibtex_authors, :partial => "suggest_author" , :locals => {:suggestions => auth, :index => idx} end else page.insert_html :top, :content, '
Error parsing BibTeX.
' end - flash.discard \ No newline at end of file