redmine-graphs-plugin/lib/issues_sidebar_graph_hook.rb
2009-05-14 14:00:39 -07:00

21 lines
1.1 KiB
Ruby

# Provides a link to the issue age graph on the issue index page
class IssuesSidebarGraphHook < Redmine::Hook::ViewListener
def view_issues_sidebar_issues_bottom(context = { })
if context[:project].nil?
output = "<h3>#{l(:label_graphs)}</h3>"
output << link_to(l(:label_graphs_old_issues), {:controller => 'graphs', :action => 'old_issues', :only_path => true})
output << "<br/>"
output << link_to(l(:label_graphs_issue_growth), {:controller => 'graphs', :action => 'issue_growth', :only_path => true})
output << "<br/>"
return output
elsif !context[:project].nil?
output = "<h3>#{l(:label_graphs)}</h3>"
output << link_to(l(:label_graphs_old_issues), {:controller => 'graphs', :action => 'old_issues', :project_id => context[:project], :only_path => true})
output << "<br/>"
output << link_to(l(:label_graphs_issue_growth), {:controller => 'graphs', :action => 'issue_growth', :project_id => context[:project], :only_path => true})
output << "<br/>"
return output
end
end
end