changeset 1417:1df2db7f0e4d biblio_alt_search_auth

Added a name getter for the Author class.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Tue, 01 Oct 2013 18:18:25 +0100
parents 96ffcd574b96
children fab9719b189e
files plugins/redmine_bibliography/app/controllers/publications_controller.rb plugins/redmine_bibliography/app/models/author.rb
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Tue Oct 01 15:07:23 2013 +0100
+++ b/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Tue Oct 01 18:18:25 2013 +0100
@@ -231,6 +231,8 @@
       @results << user unless authors_list.include?(user.author)
     end
 
+    logger.debug { "Autocomplete_for_author results --> #{@results}" }
+
     render :layout => false
   end
 
--- a/plugins/redmine_bibliography/app/models/author.rb	Tue Oct 01 15:07:23 2013 +0100
+++ b/plugins/redmine_bibliography/app/models/author.rb	Tue Oct 01 18:18:25 2013 +0100
@@ -34,4 +34,12 @@
     end
   end
 
+  def name
+    if self.authorships.first.nil?
+      ""
+    else
+      self.authorships.first.name
+    end
+  end
+
 end