# HG changeset patch # User luisf # Date 1302890571 -3600 # Node ID 50474139cad4615ebc8f0e6ca9e983c2dd963163 # Parent cd3158bf28b5bf565d2d39fc445da99746e3acbe DEV commit; new logic. diff -r cd3158bf28b5 -r 50474139cad4 vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb --- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Fri Apr 15 16:58:37 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Fri Apr 15 19:02:51 2011 +0100 @@ -8,18 +8,22 @@ # the step we're at in the form @publication.current_step = session[:publication_step] + + @new_publications = [] + session[:publications] ||= {} + end def create @publication = Publication.new(params[:publication]) @publication.current_step = session[:publication_step] - + # contents of the paste text area bibtex_entry = params[:bibtex_entry] # method for creating "pasted" bibtex entries - if bibtex_entry - parse_bibtex_list bibtex_entry + if bibtex_entry + parse_bibtex_list bibtex_entry end # form's flow control @@ -31,10 +35,15 @@ session[:publication_step] = @publication.current_step - render "new" + if @publication.new_record? + render "new" + else + session[:publication_step] = session[:publication_params] = nil + flash[:notice] = "New publication saved!" + redirect_to @publication + end end - def index @publications = Publication.find(:all) end @@ -76,13 +85,13 @@ end end - def create_bibtex_entry(d) + def create_bibtex_entry(d) @publication = Publication.new @bentry = BibtexEntry.new authors = [] institution = "" email = "" - + d.fields.keys.map do |field| case field.to_s when "author" @@ -100,7 +109,9 @@ @publication.bibtex_entry = @bentry @publication.save - + + @created_publications << @publication.id + # need to save all authors # and establish the author-publication association # via the authorships table @@ -117,15 +128,19 @@ :institution => institution, :email => email, :order => idx) - + end end - - + # parses the bibtex file def parse_bibtex_file end - + + def review_new_entries + + end + + end diff -r cd3158bf28b5 -r 50474139cad4 vendor/plugins/redmine_bibliography/app/views/publications/_new_bibtex_step.html.erb --- a/vendor/plugins/redmine_bibliography/app/views/publications/_new_bibtex_step.html.erb Fri Apr 15 16:58:37 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_new_bibtex_step.html.erb Fri Apr 15 19:02:51 2011 +0100 @@ -1,6 +1,6 @@

New Bibtex

-

Paste your bibtex entries here

+

Paste your Bibtex entries here

<%=label_tag :bibtex_entry %> <%=text_area_tag :bibtex_entry%> diff -r cd3158bf28b5 -r 50474139cad4 vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb --- a/vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb Fri Apr 15 16:58:37 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb Fri Apr 15 19:02:51 2011 +0100 @@ -5,7 +5,8 @@ <%= render :partial => "#{@publication.current_step}_bibtex_step", :locals => { :f => f } %> - <%= f.submit "Submit" %> +

<%= f.submit "Submit" %>

+

<%= f.submit "Back", :name => "back_button" unless @publication.first_step? %>

<% end %>