From 451ef7f21f411d4bfe4138a71be269f566cd4647 Mon Sep 17 00:00:00 2001
From: Eric Davis
Date: Sat, 21 Mar 2009 00:22:59 +0000
Subject: [PATCH] Added several more plugin hooks:
* :controller_custom_fields_new_after_save
* :controller_custom_fields_edit_after_save
* :view_custom_fields_form_upper_box
* :view_custom_fields_form_* (type of custom field)
* :view_issue_statuses_form
* :view_issues_show_description_bottom
* :view_my_account
* :view_users_form
#2599
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2611 e93f8b46-1217-0410-a6f0-8f06a7374b81
---
app/controllers/custom_fields_controller.rb | 2 ++
app/views/custom_fields/_form.rhtml | 2 ++
app/views/issue_statuses/_form.rhtml | 4 +++-
app/views/issues/show.rhtml | 2 ++
app/views/my/account.rhtml | 1 +
app/views/users/_form.rhtml | 1 +
6 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/app/controllers/custom_fields_controller.rb b/app/controllers/custom_fields_controller.rb
index 73ae8096a..ec101fe5a 100644
--- a/app/controllers/custom_fields_controller.rb
+++ b/app/controllers/custom_fields_controller.rb
@@ -34,6 +34,7 @@ class CustomFieldsController < ApplicationController
if request.post? and @custom_field.save
flash[:notice] = l(:notice_successful_create)
+ call_hook(:controller_custom_fields_new_after_save, :params => params, :custom_field => @custom_field)
redirect_to :action => 'index', :tab => @custom_field.class.name
end
@trackers = Tracker.find(:all, :order => 'position')
@@ -43,6 +44,7 @@ class CustomFieldsController < ApplicationController
@custom_field = CustomField.find(params[:id])
if request.post? and @custom_field.update_attributes(params[:custom_field])
flash[:notice] = l(:notice_successful_update)
+ call_hook(:controller_custom_fields_edit_after_save, :params => params, :custom_field => @custom_field)
redirect_to :action => 'index', :tab => @custom_field.class.name
end
@trackers = Tracker.find(:all, :order => 'position')
diff --git a/app/views/custom_fields/_form.rhtml b/app/views/custom_fields/_form.rhtml
index d26af9420..b9d7ec017 100644
--- a/app/views/custom_fields/_form.rhtml
+++ b/app/views/custom_fields/_form.rhtml
@@ -65,6 +65,7 @@ function toggle_custom_field_format() {
:rows => 15 %>
<%= l(:text_custom_field_possible_values_info) %>
<%= @custom_field.field_format == 'bool' ? f.check_box(:default_value) : f.text_field(:default_value) %>
+<%= call_hook(:view_custom_fields_form_upper_box, :custom_field => @custom_field, :form => f) %>
@@ -94,5 +95,6 @@ when "IssueCustomField" %>
<%= f.check_box :is_required %>
<% end %>
+<%= call_hook(:"view_custom_fields_form_#{@custom_field.type.to_s.underscore}", :custom_field => @custom_field, :form => f) %>
<%= javascript_tag "toggle_custom_field_format();" %>
diff --git a/app/views/issue_statuses/_form.rhtml b/app/views/issue_statuses/_form.rhtml
index 6ae0a7c33..b6a5bc19f 100644
--- a/app/views/issue_statuses/_form.rhtml
+++ b/app/views/issue_statuses/_form.rhtml
@@ -11,5 +11,7 @@
<%= check_box 'issue_status', 'is_default' %>
+<%= call_hook(:view_issue_statuses_form, :issue_status => @issue_status) %>
+
-
\ No newline at end of file
+
diff --git a/app/views/issues/show.rhtml b/app/views/issues/show.rhtml
index 2943f4395..ed14fe3f8 100644
--- a/app/views/issues/show.rhtml
+++ b/app/views/issues/show.rhtml
@@ -69,6 +69,8 @@ end %>
<%= link_to_attachments @issue %>
+<%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %>
+
<% if authorize_for('issue_relations', 'new') || @issue.relations.any? %>
diff --git a/app/views/my/account.rhtml b/app/views/my/account.rhtml
index ea226f5cb..b22f291f9 100644
--- a/app/views/my/account.rhtml
+++ b/app/views/my/account.rhtml
@@ -22,6 +22,7 @@
<% @user.custom_field_values.select(&:editable?).each do |value| %>
<%= custom_field_tag_with_label :user, value %>
<% end %>
+<%= call_hook(:view_my_account, :user => @user, :form => f) %>
<%= submit_tag l(:button_save) %>
diff --git a/app/views/users/_form.rhtml b/app/views/users/_form.rhtml
index 00b6aeac5..90d6ba577 100644
--- a/app/views/users/_form.rhtml
+++ b/app/views/users/_form.rhtml
@@ -16,6 +16,7 @@
<% end %>
<%= f.check_box :admin, :disabled => (@user == User.current) %>
+<%= call_hook(:view_users_form, :user => @user, :form => f) %>
--
2.39.5