# HG changeset patch # User Chris Cannam # Date 1311765837 -3600 # Node ID 168714032c7e4a7ad7f91f35bfe1fdec6c99f33a # Parent 0058debf7871ce6d5240d057b9b2323e4c0e2f4a# Parent dd9d9c0ff0f999b0e95586b35e928bc6d19567ac Merge from branch "feature_36" diff -r 0058debf7871 -r 168714032c7e vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb --- 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]) diff -r 0058debf7871 -r 168714032c7e vendor/plugins/redmine_bibliography/app/helpers/my_helper.rb --- /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 << '' << projs.join(', ') << '' + 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 << '' << auths.join(', ') << '' + else + s << auths.join(', ') + end + s + end + + +end diff -r 0058debf7871 -r 168714032c7e vendor/plugins/redmine_bibliography/app/views/my/blocks/_publications_box.html.erb --- 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 @@ -

<%=l(:label_my_publications_box)%> <%= "(" + User.current.author.authorships.count.to_s + ")" unless User.current.author.nil? %>

+<% get_my_publications %> -<% Publication.find(:all).each do |pub|%> -
-

<%= link_to pub.title, pub %>

- - <% pub.projects.each do |proj| %> - <%= link_to proj.name, proj %> - <% end %> - -
-<% end %> +

<%=l(:label_my_publications_box) %> <%= "(" + @my_publications.count.to_s + ")" %>

+ + + + + + + + + <% @my_publications.each do |publication|%> + + + + + + <% end %> + +
<%=l(:field_publication_title)%><%=l(:field_publication_authors)%><%=l(:field_publication_projects)%>
+ <%= link_to publication.title, publication %> + + <%= render_publications_authors(publication) %> + + <%= render_publications_projects(publication) %> +
+ + diff -r 0058debf7871 -r 168714032c7e vendor/plugins/redmine_bibliography/config/locales/en.yml --- 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"