changeset 1106:b5c396ea06e4 bibplugin_bibtex

Saves the temporary publication object, as well as it's id on the form.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Wed, 05 Dec 2012 19:13:15 +0000
parents 468967d012aa
children afac109ac063
files vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb vendor/plugins/redmine_bibliography/app/views/publications/new/_bibtex.html.erb vendor/plugins/redmine_bibliography/app/views/publications/parse_bibtex.rjs
diffstat 3 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Wed Dec 05 16:52:43 2012 +0000
+++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Wed Dec 05 19:13:15 2012 +0000
@@ -70,7 +70,6 @@
           create_bibtex_entry(bib[0])
           logger.error { "Bibtex Entry #{@bibtex_entry}" }
 
-
           @ieee_prev = CiteProc.process bib.to_citeproc, :style => :ieee, :format => :html
           bibtex_parsed_authors = bib[0].authors
 
@@ -82,12 +81,15 @@
             logger.error { "Added Authorship: #{auth}" }
           end
 
-          # can temporarily save
+          # we can now temporarily save this publication
           # note that the publication still needs reviewing
-          @publication.save!
+          # we are skipping the validation we only have authorships
+          # associated with the publication at this stage
+
+          # in Rails 3 this should be changed to :validate => false
+          @publication.save(false)
         end
 
-
         # todo: response for HTML
         format.js
     end
--- a/vendor/plugins/redmine_bibliography/app/views/publications/new/_bibtex.html.erb	Wed Dec 05 16:52:43 2012 +0000
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/new/_bibtex.html.erb	Wed Dec 05 19:13:15 2012 +0000
@@ -19,7 +19,7 @@
   </div>
 
   <div id="publication_info">
-    <%= hidden_field_tag "publication_id" %>
+    <%= hidden_field_tag "bibtex_pub_id" %>
   </div>
 
   <%= f.submit %>
--- a/vendor/plugins/redmine_bibliography/app/views/publications/parse_bibtex.rjs	Wed Dec 05 16:52:43 2012 +0000
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/parse_bibtex.rjs	Wed Dec 05 19:13:15 2012 +0000
@@ -6,7 +6,7 @@
     page.insert_html :bottom, :suggest_bibtex_authors, :partial => "suggest_author", :locals => {:suggestions => auth, :index => idx}
   end
 
-  page.replace_html :publication_id, @publication.id
+  page["bibtex_pub_id"].value = @publication.id
 
 else
   page.insert_html :top, :content, '<div class="flash error">Error parsing BibTeX.</div>'