Mercurial > hg > soundsoftware-site
changeset 537:168714032c7e cannam_integration
Merge from branch "feature_36"
author | Chris Cannam <chris.cannam@soundsoftware.ac.uk> |
---|---|
date | Wed, 27 Jul 2011 12:23:57 +0100 |
parents | 0058debf7871 (current diff) dd9d9c0ff0f9 (diff) |
children | a1e091bee818 |
files | |
diffstat | 4 files changed, 79 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Tue Jul 26 14:08:18 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Wed Jul 27 12:23:57 2011 +0100 @@ -3,7 +3,7 @@ class PublicationsController < ApplicationController unloadable - before_filter :find_project_by_project_id, :except => [:autocomplete_for_project, :add_author, :sort_authors, :autocomplete_for_author] + # before_filter :find_project_by_project_id, :except => [:autocomplete_for_project, :add_author, :sort_authors, :autocomplete_for_author] def new @publication = Publication.new @@ -24,8 +24,7 @@ logger.error { "PUBLICATION CREATE ACTION" } logger.error { params[:publication] } - - + @project = Project.find(params[:project_id]) logger.error { "PARAMS publication" } @@ -83,7 +82,7 @@ end def show - logger.error "-------> No Show" + find_project_by_project_id unless params[:project_id].nil? @publication = Publication.find(params[:id])
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/helpers/my_helper.rb Wed Jul 27 12:23:57 2011 +0100 @@ -0,0 +1,45 @@ +module MyHelper + + def get_my_publications() + if not User.current.author.nil? + @my_publications = Publication.all(:include => :authors, :conditions => "authors.id = #{User.current.author.id}") + else + @my_publications = [] + end + end + + def render_publications_projects(publication) + s = "" + projs = [] + + publication.projects.each do |proj| + projs << link_to(proj.name, proj) + end + + if projs.size < 3 + s << '<nobr>' << projs.join(', ') << '</nobr>' + else + s << projs.join(', ') + end + + s + end + + def render_publications_authors(publication) + s = "" + auths = [] + + publication.authorships.each do |auth| + auths << h(auth.name_on_paper) + end + + if auths.size < 3 + s << '<nobr>' << auths.join(', ') << '</nobr>' + else + s << auths.join(', ') + end + s + end + + +end
--- a/vendor/plugins/redmine_bibliography/app/views/my/blocks/_publications_box.html.erb Tue Jul 26 14:08:18 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/views/my/blocks/_publications_box.html.erb Wed Jul 27 12:23:57 2011 +0100 @@ -1,14 +1,30 @@ -<h3><%=l(:label_my_publications_box)%> <%= "(" + User.current.author.authorships.count.to_s + ")" unless User.current.author.nil? %></h3> +<% get_my_publications %> -<% Publication.find(:all).each do |pub|%> -<div class="wiki"> - <h3><%= link_to pub.title, pub %></h3> - - <% pub.projects.each do |proj| %> - <%= link_to proj.name, proj %> - <% end %> - -</div> -<% end %> +<h3><%=l(:label_my_publications_box) %> <%= "(" + @my_publications.count.to_s + ")" %> </h3> +<table class="list publications"> + <thead><tr> + <th><%=l(:field_publication_title)%></th> + <th><%=l(:field_publication_authors)%></th> + <th><%=l(:field_publication_projects)%></th> + </tr></thead> + <tbody> + + <% @my_publications.each do |publication|%> + <tr id="publication-<%= publication.id %>" class="<%= cycle('odd', 'even') %>"> + <td class="title"> + <%= link_to publication.title, publication %> + </td> + <td class="authors"> + <%= render_publications_authors(publication) %> + </td> + <td class="project"> + <%= render_publications_projects(publication) %> + </td> + </tr> + <% end %> + </tbody> +</table> + +
--- a/vendor/plugins/redmine_bibliography/config/locales/en.yml Tue Jul 26 14:08:18 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/config/locales/en.yml Wed Jul 27 12:23:57 2011 +0100 @@ -7,6 +7,10 @@ publications_box: "My Publications" label_my_publications_box: "My Publications" + field_publication_title: Title + field_publication_authors: Authors + field_publication_projects: "Associated Projects" + label_add_me_as_author: "Add me as an author" label_add_another_author: "Add another author"