changeset 403:b15397a5341c feature_36

model changes;
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Tue, 12 Apr 2011 16:35:30 +0100
parents ef8a9bc67e15
children 216a61338322
files app/models/user.rb vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb vendor/plugins/redmine_bibliography/app/models/author.rb
diffstat 3 files changed, 21 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/app/models/user.rb	Tue Apr 12 12:53:16 2011 +0100
+++ b/app/models/user.rb	Tue Apr 12 16:35:30 2011 +0100
@@ -53,6 +53,8 @@
   
   has_one :ssamr_user_detail, :dependent => :destroy, :class_name => 'SsamrUserDetail'
   accepts_nested_attributes_for :ssamr_user_detail
+  
+  has_one :author
 
   # Active non-anonymous users scope
   named_scope :active, :conditions => "#{User.table_name}.status = #{STATUS_ACTIVE}"
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Tue Apr 12 12:53:16 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Tue Apr 12 16:35:30 2011 +0100
@@ -15,6 +15,8 @@
   def parse_bibtex_text
     bibtex_entry = params[:bibtex_entry]
 
+    logger.error bibtex_entry
+
     if bibtex_entry
       bib = BibTeX.parse bibtex_entry
 
@@ -26,12 +28,22 @@
           #    d.replace!(bib.strings)
 
           d.fields.keys.map do |k|
-            @bentry[k] = d[k]
+            if k == "title"
+              @publication.title = d[k]
+            else
+              @bentry[k] = d[k]
+            end
           end
-        end                
+        end               
       end
-
+      
       @publication.bibtex_entry = @bentry
+      
+      if @publication.save
+        logger.error "SAVED"
+      else
+        logger.error "NOT SAVED"
+      end
 
       logger.error @publication.bibtex_entry
 
@@ -50,11 +62,7 @@
 
     parse_bibtex_text
 
-    if @publication.save
-      logger.error "SAVED"
-    else
-      logger.error "NOT SAVED"
-    end
+
 
     if params[:back_button]
       @publication.previous_step
--- a/vendor/plugins/redmine_bibliography/app/models/author.rb	Tue Apr 12 12:53:16 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/models/author.rb	Tue Apr 12 16:35:30 2011 +0100
@@ -1,4 +1,7 @@
 class Author < ActiveRecord::Base
   has_many :authorships
   has_many :publications, :through => :authorships
+
+  belongs_to :user
+  
 end