# HG changeset patch # User luisf # Date 1306428101 -3600 # Node ID 4ecbc22579e2c24ae2ccf2628c0d8224a222fcf8 # Parent b601a9e472f3935336bdb4be27dcb4156a5cd574 started creating the show view for one publication diff -r b601a9e472f3 -r 4ecbc22579e2 vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb --- 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 diff -r b601a9e472f3 -r 4ecbc22579e2 vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb --- 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 @@ -

Publications#show

+

<%= @publication.title %>

+

Authors

+<% @publication.authors.each do |author| %> + <%= author.name %>
+<% end %> + +

Details

+ +<%= @publication.bibtex_entry.year %> + + diff -r b601a9e472f3 -r 4ecbc22579e2 vendor/plugins/redmine_bibliography/test/test_helper.rb --- 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