changeset 391:fecd4b2f4b77 feature_36

fixed multistep form;
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Fri, 08 Apr 2011 17:08:52 +0100
parents 5562a95edbf7
children b97577523b0c
files vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb vendor/plugins/redmine_bibliography/app/models/publication.rb vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb
diffstat 3 files changed, 9 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Thu Apr 07 17:11:14 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Fri Apr 08 17:08:52 2011 +0100
@@ -23,27 +23,25 @@
         result = ''
         if d.class == BibTeX::Entry
           #    d.replace!(bib.strings)
-          result = [d.author, '. ', d.title].join
+          
+          result = [author, '. ', d.title].join
         end
+      end
 
-        logger.error result
-      end
     end
   end 
 
   def new 
     @publication = Publication.new
     @publication.current_step = session[:publication_step]
-    
-    logger.error @publication.current_step
-    
-    
+        
   end
 
   def create    
     @publication = Publication.new(params[:publication])
+    @publication.current_step = session[:publication_step]
 
-    @publication.current_step = session[:publication_step]
+    parse_bibtex_text
 
     if params[:back_button]
       @publication.previous_step
@@ -53,10 +51,6 @@
     
     session[:publication_step] = @publication.current_step
     
-    logger.error "AAAA"
-    logger.error session[:publication_step]
-
-
     render "new"
   end
 
--- a/vendor/plugins/redmine_bibliography/app/models/publication.rb	Thu Apr 07 17:11:14 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/models/publication.rb	Fri Apr 08 17:08:52 2011 +0100
@@ -17,11 +17,11 @@
   end
   
   def next_step
-    self.current_step = step[steps.index(current_step)+1]
+    self.current_step = steps[steps.index(current_step)+1]
   end
 
   def previous_step
-    self.current_step = step[steps.index(current_step)-1]
+    self.current_step = steps[steps.index(current_step)-1]
   end
   
   def first_step?
--- a/vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb	Thu Apr 07 17:11:14 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb	Fri Apr 08 17:08:52 2011 +0100
@@ -1,6 +1,6 @@
 <h1>New Publication</h1>
 
-<% form_for :publication, :url => { :action => "create" } do |f| %>
+<% form_for @publication, :url => { :action => "create" } do |f| %>
   <% f.error_messages %>
 
   <%= render :partial  => "#{@publication.current_step}_bibtex_step", :locals => { :f => f }  %>