Permalink
Browse files

I forgot to commit...

  • Loading branch information...
1 parent ee5bc09 commit cf4b937977417abc414c26fd51e1943823c2e6b7 @kawasima committed Jun 14, 2012
Showing with 44 additions and 0 deletions.
  1. +44 −0 lib/impasse_hooks.rb
View
@@ -0,0 +1,44 @@
+module ImpassePlugin
+ class Hook < Redmine::Hook::ViewListener
+ def exception(context, ex)
+ context[:controller].send(:flash)[:error] = "Impasse error: #{ex.message} (#{ex.class})"
+ RAILS_DEFAULT_LOGGER.error "#{ex.message} (#{ex.class}): " + ex.backtrace.join("\n")
+ end
+
+ def view_issues_show_details_bottom(context={ })
+ begin
+ issue = context[:issue]
+
+ return '' unless issue.project.module_enabled? 'impasse'
+
+ snippet = ''
+
+ project = context[:project]
+ execution_bug = Impasse::ExecutionBug.find_by_bug_id(issue.id)
+ test_plan_case = execution_bug.execution.test_plan_case
+
+ if execution_bug
+ snippet << "<tr><th>#{l(:field_test_case)}</th><td>" <<
+ link_to(test_plan_case.test_case.node.name, {
+ :controller => 'impasse/executions',
+ :action => 'index',
+ :project_id => project,
+ :id => test_plan_case.test_plan.id,
+ :anchor => "testcase-#{test_plan_case.test_case.id}"
+ }) <<
+ "</td></tr>"
+ end
+
+ return snippet
+ rescue => e
+ exception(context, e)
+ return ''
+ end
+ end
+
+ def controller_issues_edit_after_save(context={ })
+ params = context[:params]
+ issue = context[:issue]
+ end
+ end
+end

0 comments on commit cf4b937

Please sign in to comment.