Mercurial > hg > soundsoftware-site
changeset 540:951fcb1711f2 feature_36
Addresses Feature #234 - simple layout for the authors index page.
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Wed, 27 Jul 2011 19:12:20 +0100 |
parents | d4bf55b01092 |
children | c3abeb11bc2e |
files | vendor/plugins/redmine_bibliography/app/helpers/authors_helper.rb vendor/plugins/redmine_bibliography/app/views/authors/index.html.erb vendor/plugins/redmine_bibliography/config/locales/en.yml |
diffstat | 3 files changed, 46 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/helpers/authors_helper.rb Wed Jul 27 18:39:46 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/helpers/authors_helper.rb Wed Jul 27 19:12:20 2011 +0100 @@ -1,2 +1,20 @@ module AuthorsHelper + unloadable + + def render_author_publications(author) + s = "" + pubs = [] + + author.publications.each do |pub| + pubs << link_to(pub.title, pub) + end + + if pubs.size < 3 + s << '<nobr>' << pubs.join(', ') << '</nobr>' + else + s << pubs.join(', ') + end + s + end + end
--- a/vendor/plugins/redmine_bibliography/app/views/authors/index.html.erb Wed Jul 27 18:39:46 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/views/authors/index.html.erb Wed Jul 27 19:12:20 2011 +0100 @@ -1,5 +1,26 @@ <h2>Authors#index</h2> -<% @authors.each do |author| %> - <p><%= author.name %> - <%= author.publications.first.title%></p> -<% end %> \ No newline at end of file +<table class="list authors"> + <thead><tr> + <th><%=l(:field_author_name)%></th> + <th><%=l(:field_author_username)%></th> + <th><%=l(:field_author_publications)%></th> + </tr></thead> + <tbody> + + <% @authors.each do |author|%> + <tr id="author-<%= author.id %>" class="<%= cycle('odd', 'even') %>"> + <td class="title"> + <%= h author.name %> + </td> + <td class="username "> + <%= link_to author.user unless author.user.nil? %> + </td> + <td class="project"> + <%= render_author_publications(author) %> + </td> + </tr> + <% end %> + </tbody> +</table> +
--- a/vendor/plugins/redmine_bibliography/config/locales/en.yml Wed Jul 27 18:39:46 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/config/locales/en.yml Wed Jul 27 19:12:20 2011 +0100 @@ -9,7 +9,10 @@ field_publication_title: Title field_publication_authors: Authors - field_publication_projects: "Associated Projects" + field_publication_projects: "Associated Projects" + field_author_name: Author + field_author_username: "Associated User" + field_author_publications: "Publications by this Author" label_add_me_as_author: "Add me as an author" label_add_another_author: "Add another author"