diff plugins/redmine_bibliography/app/models/authorship.rb @ 1397:bf2db886a543 biblio_alt_search_auth

keeps the state of the hidden fields when validation fails.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Sat, 28 Sep 2013 16:21:53 +0100
parents 0e4c6c2f400e
children 92d854be33d5
line wrap: on
line diff
--- a/plugins/redmine_bibliography/app/models/authorship.rb	Sat Sep 28 16:05:15 2013 +0100
+++ b/plugins/redmine_bibliography/app/models/authorship.rb	Sat Sep 28 16:21:53 2013 +0100
@@ -44,12 +44,12 @@
     # using default setter (attr_writer)
 
     if self.author.nil?
-      @search_author_class = ""
+      aclass = ""
     else
-      @search_author_class = "Author"
+      aclass = "Author"
     end
 
-    @search_author_class
+    @search_author_class || aclass
   end
 
   # def search_author_class=(search_author_class)
@@ -58,19 +58,22 @@
 
   def search_author_id
     if self.author.nil?
-      "xxx"
+      authid = "xxx"
     else
-      author_id
+      authid = author_id
     end
+
+    @search_author_id || authid
   end
 
   def search_author_tie
     if self.author.nil?
-      return false
+      auth_tie = false
     else
-      return true
+      auth_tie = true
     end
 
+    @search_author_tie || auth_tie
   end
 
   def name