changeset 612:8fa35731c959 feature_36

Created the show actions and view for Authors, addressing Features #234 and #235.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Tue, 23 Aug 2011 13:45:30 +0100
parents e918338dedfc
children 3b63cea01e7b
files vendor/plugins/redmine_bibliography/app/controllers/authors_controller.rb vendor/plugins/redmine_bibliography/app/helpers/authors_helper.rb vendor/plugins/redmine_bibliography/app/views/authors/index.html.erb vendor/plugins/redmine_bibliography/app/views/authors/show.html.erb vendor/plugins/redmine_bibliography/config/locales/en.yml
diffstat 5 files changed, 46 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/controllers/authors_controller.rb	Mon Aug 22 14:38:31 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/controllers/authors_controller.rb	Tue Aug 23 13:45:30 2011 +0100
@@ -4,4 +4,9 @@
     @authors = Author.find(:all)
   end
 
+  def show
+    @author = Author.find(params[:id])  
+
+  end
+
 end
--- a/vendor/plugins/redmine_bibliography/app/helpers/authors_helper.rb	Mon Aug 22 14:38:31 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/helpers/authors_helper.rb	Tue Aug 23 13:45:30 2011 +0100
@@ -17,4 +17,12 @@
     s    
   end
   
+  
+  # Generates a link to an author
+  #   todo: test options
+  def link_to_author(author, options={}, html_options = nil)
+    url = {:controller => 'authors', :action => 'show', :id => author}.merge(options)
+    link_to(h(author.name), url, html_options)
+  end
+
 end
--- a/vendor/plugins/redmine_bibliography/app/views/authors/index.html.erb	Mon Aug 22 14:38:31 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/authors/index.html.erb	Tue Aug 23 13:45:30 2011 +0100
@@ -1,4 +1,4 @@
-<h2>Authors#index</h2>
+<h2><%=l(:label_authors_index)%></h2>
 
 <table class="list authors">		
 	<thead><tr>
@@ -11,7 +11,7 @@
   <% @authors.each do |author|%>    
 	<tr id="author-<%= author.id %>" class="<%= cycle('odd', 'even') %>">
 		<td class="title">
-			<%= h author.name %>
+			<%= link_to_author author %>
 		</td>
     <td class="username ">
       <%= link_to author.user unless author.user.nil? %>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/plugins/redmine_bibliography/app/views/authors/show.html.erb	Tue Aug 23 13:45:30 2011 +0100
@@ -0,0 +1,24 @@
+<h2><%=l(:label_authors_show)%></h2>
+
+<div class="splitcontentleft">
+  <table class="list authors">		
+  	<thead>
+  	  <tr>
+  	    <th><%=l(:field_authorship_publication_title)%></th>
+  	    <th><%=l(:field_authorship_name)%></th>
+  	    <th><%=l(:field_authorship_email)%></th>
+	 	    <th><%=l(:field_authorship_institution)%></th>
+  	  </tr>
+  	</thead>
+  
+     <% @author.authorships.each do |authorship| %>
+       <tr id="authorship-<%= authorship.id %>" class="<%= cycle('odd', 'even') %>">
+         <td class="title"><%= h authorship.publication.title %></td>
+         <td class="name"><%= h authorship.name_on_paper %></td>
+         <td class="email"><%= h authorship.email %></td>
+         <td class="institution"><%= h authorship.institution %></td>
+       </tr>
+    <% end %>
+  	</tbody>
+  </table>
+</div>
\ No newline at end of file
--- a/vendor/plugins/redmine_bibliography/config/locales/en.yml	Mon Aug 22 14:38:31 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/config/locales/en.yml	Tue Aug 23 13:45:30 2011 +0100
@@ -10,6 +10,13 @@
 
   label_all_publications: All Publications
   label_all_publications_for_project: Publications associated with %{project}
+  label_authors_show: "Authorships by this author"
+  label_authors_show: "List of authors"
+  
+  field_authorship_publication_title: "Publication Title"
+  field_authorship_name: "Name"
+  field_authorship_email: "Email Address"
+  field_authorship_institution: "Institution"
   
   field_publication_title: Title
   field_publication_authors: Authors