changeset 429:27930c9b424d feature_36

update method in publications controller; updated view
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Thu, 02 Jun 2011 14:39:11 +0100
parents 9cfd7a1d848e
children 948400933de8 b461f84ed41a
files vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb vendor/plugins/redmine_bibliography/app/views/publications/edit.html.erb
diffstat 2 files changed, 11 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Wed Jun 01 17:27:52 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Thu Jun 02 14:39:11 2011 +0100
@@ -54,14 +54,17 @@
 
   def edit
     @publication = Publication.find(params[:id])
-
-
+    
   end
 
   def update
-
-    logger.error "AAAA 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
--- a/vendor/plugins/redmine_bibliography/app/views/publications/edit.html.erb	Wed Jun 01 17:27:52 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/edit.html.erb	Thu Jun 02 14:39:11 2011 +0100
@@ -1,49 +1,9 @@
 <h2>Publications#edit</h2>
 
-<% form_for @publication, :url => {:action => :edit} do |f| -%>
-  <%= f.error_messages %>
-  <p>
-    <%= f.label :title, l(:title) %>  <%= f.text_field :title %>  
-  </p>
-  
+<%= render :partial => 'edit' %>
 
-  <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 -%>
 
+<p>
+  <%= link_to :show %></p>
 
 
-  <%= f.submit "Submit" %>
-
-
-
-
-
-<% end -%>
\ No newline at end of file