From: Eric Davis
Date: Tue, 10 Jun 2008 22:08:44 +0000 (-0700)
Subject: Changed Hook API to use a Manager class. #1296
X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=04434cd6efa5665a983a2b8acde20b898fcf28c0;p=redmine.git
Changed Hook API to use a Manager class. #1296
---
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index 75b0c7945..7d36ce88d 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -233,9 +233,8 @@ class IssuesController < ApplicationController
issue.start_date = params[:start_date] unless params[:start_date].blank?
issue.due_date = params[:due_date] unless params[:due_date].blank?
issue.done_ratio = params[:done_ratio] unless params[:done_ratio].blank?
- if Redmine::Plugin::Hook.hook_registered?(:issue_bulk_edit_save)
- Redmine::Plugin::Hook.call_hook(:issue_bulk_edit_save, {:params => params, :issue => issue })
- end
+
+ Redmine::Plugin::Hook::Manager.call_hook(:issue_bulk_edit_save, {:params => params, :issue => issue })
# Don't save any change to the issue if the user is not authorized to apply the requested status
if (status.nil? || (issue.status.new_status_allowed_to?(status, current_role, issue.tracker) && issue.status = status)) && issue.save
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index 5b1330b6e..009947424 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -87,7 +87,7 @@ module IssuesHelper
label = l(:label_attachment)
end
- Redmine::Plugin::Hook.call_hook(:issues_helper_show_details, {:detail => detail, :label => label, :value => value, :old_value => old_value })
+ Redmine::Plugin::Hook::Manager.call_hook(:issues_helper_show_details, {:detail => detail, :label => label, :value => value, :old_value => old_value })
label ||= detail.prop_key
value ||= detail.value
diff --git a/app/views/issues/_form.rhtml b/app/views/issues/_form.rhtml
index f933a7c35..cdff2e45c 100644
--- a/app/views/issues/_form.rhtml
+++ b/app/views/issues/_form.rhtml
@@ -48,8 +48,6 @@
<%= render :partial => 'attachments/form' %>
<% end %>
-<% if Redmine::Plugin::Hook.hook_registered?(:issue_edit) %>
- <%= Redmine::Plugin::Hook.call_hook(:issue_edit, {:project => @project, :issue => @issue, :form => f }) %>
-<% end %>
+<%= Redmine::Plugin::Hook::Manager.call_hook(:issue_edit, {:project => @project, :issue => @issue, :form => f }) %>
<%= wikitoolbar_for 'issue_description' %>
diff --git a/app/views/issues/bulk_edit.rhtml b/app/views/issues/bulk_edit.rhtml
index 92a340a93..e001e0d87 100644
--- a/app/views/issues/bulk_edit.rhtml
+++ b/app/views/issues/bulk_edit.rhtml
@@ -38,9 +38,7 @@
-<% if Redmine::Plugin::Hook.hook_registered?(:issue_bulk_edit) %>
- <%= Redmine::Plugin::Hook.call_hook(:issue_bulk_edit, {:project => @project, :issue => @issues }) %>
-<% end %>
+<%= Redmine::Plugin::Hook::Manager.call_hook(:issue_bulk_edit, {:project => @project, :issue => @issues }) %>