Mercurial > hg > soundsoftware-site
changeset 390:5562a95edbf7 feature_36
DEV commit - problems in the create action;
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Thu, 07 Apr 2011 17:11:14 +0100 |
parents | 8ed0a0a268e0 |
children | fecd4b2f4b77 |
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_bibtex_step.html.erb vendor/plugins/redmine_bibliography/app/views/publications/_review_bibtex_step.html.erb vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb |
diffstat | 5 files changed, 46 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Tue Apr 05 20:54:40 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Thu Apr 07 17:11:14 2011 +0100 @@ -32,29 +32,32 @@ end def new - session[:publication_params] ||= {} @publication = Publication.new @publication.current_step = session[:publication_step] - - if request.post? - parse_bibtex_text - @publication = Publication.new(params[:publication]) - - if @publication.save - logger.error "GRAVOU XXXdsfgXXX" - else - logger.error "nao gravou" - end - - end - + + logger.error @publication.current_step + + end - def create + def create + @publication = Publication.new(params[:publication]) - logger.error "AAAA create" + @publication.current_step = session[:publication_step] - @publication.save + if params[:back_button] + @publication.previous_step + else + @publication.next_step + end + + session[:publication_step] = @publication.current_step + + logger.error "AAAA" + logger.error session[:publication_step] + + + render "new" end def index
--- a/vendor/plugins/redmine_bibliography/app/models/publication.rb Tue Apr 05 20:54:40 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/models/publication.rb Thu Apr 07 17:11:14 2011 +0100 @@ -15,6 +15,17 @@ def steps %w[new review] end + + def next_step + self.current_step = step[steps.index(current_step)+1] + end + def previous_step + self.current_step = step[steps.index(current_step)-1] + end + + def first_step? + current_step == steps.first + end end
--- a/vendor/plugins/redmine_bibliography/app/views/publications/_new_bibtex_step.html.erb Tue Apr 05 20:54:40 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_new_bibtex_step.html.erb Thu Apr 07 17:11:14 2011 +0100 @@ -1,13 +1,13 @@ +<h3>New Bibtex</h3> - <h1>New Bibtex</h1> - <p> - <%= f.label :title %> - <%= f.text_field :title %> - </p> +<p> + <%= f.label :title %> + <%= f.text_field :title %> +</p> - <p> - <%=label_tag :bibtex_entry %> - <%=text_area_tag :bibtex_entry%> - </p> +<p> + <%=label_tag :bibtex_entry %> + <%=text_area_tag :bibtex_entry%> +</p>
--- a/vendor/plugins/redmine_bibliography/app/views/publications/_review_bibtex_step.html.erb Tue Apr 05 20:54:40 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_review_bibtex_step.html.erb Thu Apr 07 17:11:14 2011 +0100 @@ -0,0 +1,2 @@ +<h2>Review new entries</h2> +
--- a/vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb Tue Apr 05 20:54:40 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb Thu Apr 07 17:11:14 2011 +0100 @@ -1,11 +1,12 @@ <h1>New Publication</h1> -<% form_for :publication do |f| %> +<% form_for :publication, :url => { :action => "create" } do |f| %> <% f.error_messages %> - <% render :partial => "#{@publication.current_step}_bibtex_step", :locals => { :f => f } %> + <%= render :partial => "#{@publication.current_step}_bibtex_step", :locals => { :f => f } %> - <%= submit_tag l(:button_submit) %> + <%= f.submit "Continue" %> + <%= f.submit "Back", :name => "back_button" unless @publication.first_step? %> <% end %>