changeset 430:948400933de8 feature_36

partial publication form
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Fri, 03 Jun 2011 18:16:34 +0100
parents 27930c9b424d
children 77f88379115a
files vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb vendor/plugins/redmine_bibliography/app/views/publications/_edit.html.erb
diffstat 2 files changed, 60 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Thu Jun 02 14:39:11 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Fri Jun 03 18:16:34 2011 +0100
@@ -54,20 +54,28 @@
 
   def edit
     @publication = Publication.find(params[:id])
+  end
+
+  def update
+    
+    logger.error "------>>>> NO UPDATE"
+    
+    @publication = Publication.find(params[:id])
+    
+    logger.error @publication
+    
+    if @publication.update_attributes(params[:publication])
+      flash[:notice] = "Successfully updated Publication."
+      redirect_to :action => :show, :id => @publication.id
+    else
+      render :action => 'edit' 
+    end
     
   end
 
-  def update
-    @publication = Publication.find(params[:id])
-    if @publication.update_attributes(params[:publication])
-      flash[:notice] = "Successfully updated Publication."
-      redirect_to @publication
-    else
-      render :action => 'edit'
-    end
-  end
-
   def show
+    logger.error "-------> No Show"
+    
     @publication = Publication.find(params[:id])
 
     if @publication.nil?
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/_edit.html.erb	Fri Jun 03 18:16:34 2011 +0100
@@ -0,0 +1,42 @@
+
+<% form_for @publication, :url => {:action => :update }, :id => 13 do |f| -%>
+  <%= f.error_messages %>
+  <p>
+    <%= f.label :title, l(:title) %>  <%= f.text_field :title %>  
+  </p>
+  
+
+  <h3><%= l(:authors) -%></h3>
+  
+  <% f.fields_for :authors do |author| %>
+    <p>
+      <%= author.label :name, l("name") %> <%= author.text_field :name %>            
+    </p>
+    
+  <% end %>
+  
+  
+  <% f.fields_for @publication.bibtex_entry do |b| -%>
+    <p> 
+      <%= b.label :year, l(:year) %>  <%= b.text_field :year %>  
+    </p>
+    <p> 
+      <%= b.label :chapter, l(:chapter) %>  <%= b.text_field :chapter %>  
+    </p>
+    <p>  
+      <%= b.label :editor, l(:editor) %>  <%= b.text_field :editor %>  
+    </p>
+    <p> 
+      <%= b.label :booktitle, l(:booktitle) %>  <%= b.text_field :booktitle %>  
+    </p>
+    <p> 
+      <%= b.label :publisher, l(:publisher) %>  <%= b.text_field :publisher %>  
+    </p>
+    <p> 
+      <%= b.label :pages, l(:pages) %>  <%= b.text_field :pages %>  
+    </p>
+  <% end -%>
+
+  <%= f.submit %>
+
+<% end -%>