# HG changeset patch # User luisf # Date 1344015188 -3600 # Node ID 010291c90b0b09a096eb8d717c8640ba211af663 # Parent be4106d14a359c34b95d77cbe5bac57770ae1ea5 Fixes a bug with the authors div - it was being replicated for each author; added a fieldset in order to better handle each author; simulates a click for each author in the parsing of the bibtex file. diff -r be4106d14a35 -r 010291c90b0b vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb --- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Wed Jul 18 16:57:54 2012 +0100 +++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Fri Aug 03 18:33:08 2012 +0100 @@ -43,10 +43,21 @@ bibtex_entry_no = BibtexEntryType.find_by_name(bib[0].type.to_s).id page["publication_title"].value = bib[0][:title] page["publication_bibtex_entry_attributes_entry_type"].value = bibtex_entry_no - + BibtexEntryType.fields(bibtex_entry_no).each do |field| page["publication_bibtex_entry_attributes_#{field}"].value = bib[0][field] end + + # for each author simulates a click and fills the author info + bib[0].authors.each do |author| + page["add_another_author"].click +# page.alert(bib[0].authors.length) +# page.alert(page["authors"].first.id) + + end + + + } } end diff -r be4106d14a35 -r 010291c90b0b vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.html.erb --- a/vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.html.erb Wed Jul 18 16:57:54 2012 +0100 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.html.erb Fri Aug 03 18:33:08 2012 +0100 @@ -1,9 +1,6 @@ <%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %> - -
- - +
>

<%= f.text_field :search_name, :size => 25 %> @@ -42,7 +39,6 @@

-

<%- if params[:action] == 'new' -%> @@ -54,5 +50,8 @@ <%= link_to_remove_fields l("remove_author"), f %>

-
-
+
+
+ + + diff -r be4106d14a35 -r 010291c90b0b vendor/plugins/redmine_bibliography/app/views/publications/_form.html.erb --- a/vendor/plugins/redmine_bibliography/app/views/publications/_form.html.erb Wed Jul 18 16:57:54 2012 +0100 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_form.html.erb Fri Aug 03 18:33:08 2012 +0100 @@ -17,8 +17,10 @@

<%= l(:authors) %>

- <% f.fields_for :authorships do |builder| -%> - <%= render "authorship_fields", :f => builder %> - <%- end -%> +
+ <% f.fields_for :authorships do |builder| -%> + <%= render "authorship_fields", :f => builder %> + <%- end -%> +
<%= link_to_add_author_fields l(:label_add_an_author), f, :authorships, params[:action] %>