changeset 479:7be2c5d9ffa5 feature_36

correctly saving ONE authorship model when creating new publication.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Thu, 30 Jun 2011 12:54:10 +0100
parents 7097dc91e58e
children 19efecf4561a
files vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb vendor/plugins/redmine_bibliography/app/views/publications/add_me_as_author.rjs
diffstat 2 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Wed Jun 29 17:12:03 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Thu Jun 30 12:54:10 2011 +0100
@@ -67,11 +67,11 @@
          logger.error { "current user has no author" }
          @author = Author.new(:user_id => User.current, :name => User.current.name)
        else
-         logger.error { "current user does not have an author" }
+         logger.error { "current user already has an author" }
          @author = User.current.author
        end
        
-      @authorship = Authorship.create(:author => @author, :publication => @publication)                    
+      # @authorship = Authorship.create(:author => @author, :publication => @publication)                    
      else
        # No?  Then render an action.
        #render :action => 'view_attribute', :attr => @name
--- a/vendor/plugins/redmine_bibliography/app/views/publications/add_me_as_author.rjs	Wed Jun 29 17:12:03 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/add_me_as_author.rjs	Thu Jun 30 12:54:10 2011 +0100
@@ -1,2 +1,3 @@
 page["publication_authorships_attributes_0_name_on_paper"].value = User.current.name
-page["publication_authorships_attributes_0_institution"].value = User.current.ssamr_user_detail.institution_id.to_i
+page["publication_authorships_attributes_0_institution"].value = Institution.find(User.current.ssamr_user_detail.institution_id.to_i).name
+page["publication_authorships_attributes_0_email"].value = User.current.mail
\ No newline at end of file