diff vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb @ 425:4ecbc22579e2 feature_36

started creating the show view for one publication
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Thu, 26 May 2011 17:41:41 +0100
parents b601a9e472f3
children 9cfd7a1d848e
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Wed May 25 17:46:49 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Thu May 26 17:41:41 2011 +0100
@@ -1,6 +1,8 @@
 # vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb
 
 class PublicationsController < ApplicationController
+  # TODO: should be removed on production version?
+  unloadable
 
   def new
     # we always try to create at least one publication
@@ -61,9 +63,21 @@
 
   end
 
-  def show  
-    @publication = Publication.find(params[id])
-    @authors = @publication.authors
+  def show
+    @publication = Publication.find_by_id(params[:id])
+
+    if @publication.nil?
+        @publications = Publication.all
+        render "index", :alert => 'Your Publications was not found!'
+    else
+      @authors = @publication.authors
+      @bibtext_entry = @publication.bibtex_entry
+    
+      respond_to do |format|
+        format.html
+        format.xml {render :xml => @publication}
+      end
+    end
   end
 
   # parse string with bibtex authors