Revision 425:4ecbc22579e2
| vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb | ||
|---|---|---|
| 1 | 1 |
# vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb |
| 2 | 2 |
|
| 3 | 3 |
class PublicationsController < ApplicationController |
| 4 |
# TODO: should be removed on production version? |
|
| 5 |
unloadable |
|
| 4 | 6 |
|
| 5 | 7 |
def new |
| 6 | 8 |
# we always try to create at least one publication |
| ... | ... | |
| 61 | 63 |
|
| 62 | 64 |
end |
| 63 | 65 |
|
| 64 |
def show |
|
| 65 |
@publication = Publication.find(params[id]) |
|
| 66 |
@authors = @publication.authors |
|
| 66 |
def show |
|
| 67 |
@publication = Publication.find_by_id(params[:id]) |
|
| 68 |
|
|
| 69 |
if @publication.nil? |
|
| 70 |
@publications = Publication.all |
|
| 71 |
render "index", :alert => 'Your Publications was not found!' |
|
| 72 |
else |
|
| 73 |
@authors = @publication.authors |
|
| 74 |
@bibtext_entry = @publication.bibtex_entry |
|
| 75 |
|
|
| 76 |
respond_to do |format| |
|
| 77 |
format.html |
|
| 78 |
format.xml {render :xml => @publication}
|
|
| 79 |
end |
|
| 80 |
end |
|
| 67 | 81 |
end |
| 68 | 82 |
|
| 69 | 83 |
# parse string with bibtex authors |
| vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb | ||
|---|---|---|
| 1 |
<h2>Publications#show</h2>
|
|
| 1 |
<h2><%= @publication.title %></h2>
|
|
| 2 | 2 |
|
| 3 |
<h3>Authors</h3> |
|
| 4 |
<% @publication.authors.each do |author| %> |
|
| 5 |
<%= author.name %> <br /> |
|
| 6 |
<% end %> |
|
| 7 |
|
|
| 8 |
<h3>Details</h3> |
|
| 9 |
|
|
| 10 |
<%= @publication.bibtex_entry.year %> |
|
| 11 |
|
|
| 12 |
|
|
| vendor/plugins/redmine_bibliography/test/test_helper.rb | ||
|---|---|---|
| 5 | 5 |
# Ensure that we are using the temporary fixture path |
| 6 | 6 |
Engines::Testing.set_fixture_path |
| 7 | 7 |
|
| 8 |
class PublicationsControllerTest < ActionController::TestCase
|
|
| 9 |
fixtures :publications, :authors, :bibtex_entries, :authorships
|
|
| 8 |
class BibliographyControllerTest < ActionController::TestCase
|
|
| 9 |
fixtures :all
|
|
| 10 | 10 |
|
| 11 | 11 |
def setup |
| 12 | 12 |
end |
| 13 | 13 |
|
| 14 |
def test_publication |
|
| 15 |
|
|
| 16 |
end |
|
| 17 |
|
|
| 18 |
|
|
| 14 | 19 |
def test_routing |
| 15 | 20 |
assert_routing( |
| 21 |
{:method => :get, :path => '/requirements'},
|
|
| 22 |
:controller => 'requirements', :action => 'index' |
|
| 16 | 23 |
) |
| 17 | 24 |
end |
Also available in: Unified diff