changeset 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 8a8b7a042b9a
files vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb vendor/plugins/redmine_bibliography/test/test_helper.rb
diffstat 3 files changed, 37 insertions(+), 6 deletions(-) [+]
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
--- a/vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb	Wed May 25 17:46:49 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb	Thu May 26 17:41:41 2011 +0100
@@ -1,2 +1,12 @@
-<h2>Publications#show</h2>
+<h2><%= @publication.title %></h2>
 
+<h3>Authors</h3>
+<% @publication.authors.each do |author| %>
+  <%= author.name  %> <br />
+<% end %>
+
+<h3>Details</h3>
+
+<%= @publication.bibtex_entry.year %>
+
+
--- a/vendor/plugins/redmine_bibliography/test/test_helper.rb	Wed May 25 17:46:49 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/test/test_helper.rb	Thu May 26 17:41:41 2011 +0100
@@ -5,13 +5,20 @@
 # Ensure that we are using the temporary fixture path
 Engines::Testing.set_fixture_path
 
-class PublicationsControllerTest < ActionController::TestCase
-  fixtures :publications, :authors, :bibtex_entries, :authorships
+class BibliographyControllerTest < ActionController::TestCase
+  fixtures :all
 
   def setup
   end
 
+  def test_publication
+  
+  end
+  
+
   def test_routing
     assert_routing(
+          {:method => :get, :path => '/requirements'},
+          :controller => 'requirements', :action => 'index'
         )
   end