# HG changeset patch # User Chris Cannam # Date 1363183201 0 # Node ID e0167f4e1d8a59e7524b4e017ce683d33d6aa8c4 # Parent ed0d04113c935f74be90bb01219d469dcaac2986 We have a MyHelper now, so we need a MyHelperPatch (also some other minor fixes) diff -r ed0d04113c93 -r e0167f4e1d8a app/views/my/page.html.erb --- a/app/views/my/page.html.erb Wed Mar 13 13:10:49 2013 +0000 +++ b/app/views/my/page.html.erb Wed Mar 13 14:00:01 2013 +0000 @@ -4,7 +4,7 @@
<%= link_to l(:label_personalize_page), :action => 'page_layout' %> - <%= '| ' + link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %> + <%= ('| ' + link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add')).html_safe if User.current.allowed_to?(:add_project, nil, :global => true) %>

<%=l(:label_my_page)%>

diff -r ed0d04113c93 -r e0167f4e1d8a plugins/redmine_bibliography/app/helpers/my_helper.rb --- a/plugins/redmine_bibliography/app/helpers/my_helper.rb Wed Mar 13 13:10:49 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -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 - - s << projs.join(', ') - - s - end - - def render_publications_authors(publication) - s = "" - auths = [] - - publication.authorships.each do |auth| - auths << h(auth.name_on_paper) - end - - s << auths.join(', ') - - s - end - - -end diff -r ed0d04113c93 -r e0167f4e1d8a plugins/redmine_bibliography/init.rb --- a/plugins/redmine_bibliography/init.rb Wed Mar 13 13:10:49 2013 +0000 +++ b/plugins/redmine_bibliography/init.rb Wed Mar 13 14:00:01 2013 +0000 @@ -24,6 +24,10 @@ unless ProjectsHelper.included_modules.include?(Bibliography::ProjectsHelperPatch) ProjectsHelper.send(:include, Bibliography::ProjectsHelperPatch) end + + unless MyHelper.included_modules.include?(Bibliography::MyHelperPatch) + MyHelper.send(:include, Bibliography::MyHelperPatch) + end end diff -r ed0d04113c93 -r e0167f4e1d8a plugins/redmine_bibliography/lib/bibliography/my_helper_patch.rb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/redmine_bibliography/lib/bibliography/my_helper_patch.rb Wed Mar 13 14:00:01 2013 +0000 @@ -0,0 +1,52 @@ +module Bibliography + module MyHelperPatch + + def self.included(base) # :nodoc: + base.send(:include, InstanceMethods) + + base.class_eval do + unloadable + end + end + + module InstanceMethods + + 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 + + s << projs.join(', ') + + s.html_safe + end + + def render_publications_authors(publication) + s = "" + auths = [] + + publication.authorships.each do |auth| + auths << h(auth.name_on_paper) + end + + s << auths.join(', ') + + s.html_safe + end + + + end + end +end +