changeset 951:010291c90b0b bibplugin_bibtex

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.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Fri, 03 Aug 2012 18:33:08 +0100
parents be4106d14a35
children 12f729c9f47d
files vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.html.erb vendor/plugins/redmine_bibliography/app/views/publications/_form.html.erb
diffstat 3 files changed, 23 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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' %>
 
-
-<div id="authors" class="fields">
-<!--  <h4><%= l("label_author_1") %></h4> -->
-
+<fieldset>
   <div id="<%= form_tag_id( f.object_name, :search_author ) %>" style=<%= "display:none;" unless params[:action] == "new" %> >
       <p>
         <%= f.text_field :search_name, :size => 25 %>
@@ -42,7 +39,6 @@
   <div class="box" id="<%= form_tag_id( f.object_name, :show_author_info ) %>" style="display: none">
 	
   </div>
-
   <p>
 
   <%- if params[:action] == 'new' -%>
@@ -54,5 +50,8 @@
 
   <%= link_to_remove_fields l("remove_author"), f %>
   </p>
-</div>
-<br/>
+</fieldset>
+<br />
+
+
+
--- 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 @@
 
 <h3><%= l(:authors) %></h3>    
 <div class="box tabular">
-  <% f.fields_for :authorships do |builder| -%>
-    <%= render "authorship_fields", :f => builder %>
-  <%- end -%>
+  <div id="authors" class="fields">
+    <% f.fields_for :authorships do |builder| -%>
+      <%= render "authorship_fields", :f => builder %>
+      <%- end -%>
+  </div>
   <%= link_to_add_author_fields l(:label_add_an_author), f, :authorships, params[:action] %>
 </div>