changeset 1285:22551cc54749 redmine-2.2-integration

adds the author's object class to the form
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Tue, 14 May 2013 16:05:54 +0100
parents 3ce07a57ce68
children d0d6bbe9f2e0
files plugins/redmine_bibliography/app/views/publications/_authorship_fields.html.erb plugins/redmine_bibliography/app/views/publications/autocomplete_for_author.html.erb plugins/redmine_bibliography/assets/javascripts/authors.js
diffstat 3 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/redmine_bibliography/app/views/publications/_authorship_fields.html.erb	Tue May 14 15:51:20 2013 +0100
+++ b/plugins/redmine_bibliography/app/views/publications/_authorship_fields.html.erb	Tue May 14 16:05:54 2013 +0100
@@ -27,6 +27,8 @@
       <p><%= f.text_field :email, {:class => ("readonly" unless params[:action] == "new") }  %></p>
       <p class='description' style=<%= "display:none;" unless params[:action] == "new" %>><%= h l("text_author_email") %></p>
     </p>
+        <%= hidden_field_tag(:object_class, '', :name => form_tag_name(f.object_name,:object_class ), :id => form_tag_id( f.object_name, :object_class )) -%>
+
   </div>
 
 
--- a/plugins/redmine_bibliography/app/views/publications/autocomplete_for_author.html.erb	Tue May 14 15:51:20 2013 +0100
+++ b/plugins/redmine_bibliography/app/views/publications/autocomplete_for_author.html.erb	Tue May 14 16:05:54 2013 +0100
@@ -2,7 +2,7 @@
       'id' => result.id,
       'label' => "#{result.name} (#{result.mail.partition('@')[2]})",
       'value' => result.name,
-      'type' => result.class.name,
+      'object_class' => result.class.name,
       'institution' => result.institution,
       'email' => result.mail,
       }
--- a/plugins/redmine_bibliography/assets/javascripts/authors.js	Tue May 14 15:51:20 2013 +0100
+++ b/plugins/redmine_bibliography/assets/javascripts/authors.js	Tue May 14 16:05:54 2013 +0100
@@ -24,6 +24,7 @@
             $this.closest('div').next().find("input[id$='name_on_paper']").val(ui.item.value);
             $this.closest('div').next().find("input[id$='institution']").val(ui.item.institution);
             $this.closest('div').next().find("input[id$='email']").val(ui.item.email);
+            $this.closest('div').next().find("input[id$='object_class']").val(ui.item.object_class);
         }
     });
 });