Ported plugin hooks to the final Redmine Plugin hook API. #1431
This commit is contained in:
1 parent
52873f5b9b
commit
802df93318
3 files changed
+27
-34
No files matched your search
+13
-14
@@ -1,15 +1,14 @@
|
||||
# Hooks to attach to the Redmine Issues. They are attached in init.rb by the
|
||||
# +add_hook+ method
|
||||
class BudgetIssueHook < Redmine::Plugin::Hook::Base
|
||||
# Hooks to attach to the Redmine Issues.
|
||||
class BudgetIssueHook < Redmine::Hook::ViewListener
|
||||
|
||||
# Renders the Deliverable subject
|
||||
#
|
||||
# Context:
|
||||
# * :issue => Issue being rendered
|
||||
#
|
||||
def self.issue_show(context = { })
|
||||
def view_issues_show_details_bottom(context = { })
|
||||
if context[:project].module_enabled?('budget_module')
|
||||
data = "<td><b>Deliverable :</b></td><td>#{help.html_escape context[:issue].deliverable.subject unless context[:issue].deliverable.nil?}</td>"
|
||||
data = "<td><b>Deliverable :</b></td><td>#{html_escape context[:issue].deliverable.subject unless context[:issue].deliverable.nil?}</td>"
|
||||
return "<tr>#{data}<td></td></tr>"
|
||||
else
|
||||
return ''
|
||||
@@ -22,7 +21,7 @@ class BudgetIssueHook < Redmine::Plugin::Hook::Base
|
||||
# * :form => Edit form
|
||||
# * :project => Current project
|
||||
#
|
||||
def self.issue_edit(context = { })
|
||||
def view_issues_form_details_bottom(context = { })
|
||||
if context[:project].module_enabled?('budget_module')
|
||||
select = context[:form].select :deliverable_id, Deliverable.find_all_by_project_id(context[:project], :order => 'subject ASC').collect { |d| [d.subject, d.id] }, :include_blank => true
|
||||
return "<p>#{select}</p>"
|
||||
@@ -36,14 +35,14 @@ class BudgetIssueHook < Redmine::Plugin::Hook::Base
|
||||
# Context:
|
||||
# * :project => Current project
|
||||
#
|
||||
def self.issue_bulk_edit(context = { })
|
||||
def view_issues_bulk_edit_details_bottom(context = { })
|
||||
if context[:project].module_enabled?('budget_module')
|
||||
select = help.select_tag('deliverable_id',
|
||||
help.content_tag('option', GLoc.l(:label_no_change_option), :value => '') +
|
||||
help.content_tag('option', GLoc.l(:label_none), :value => 'none') +
|
||||
help.options_from_collection_for_select(Deliverable.find_all_by_project_id(context[:project].id, :order => 'subject ASC'), :id, :subject))
|
||||
select = select_tag('deliverable_id',
|
||||
content_tag('option', GLoc.l(:label_no_change_option), :value => '') +
|
||||
content_tag('option', GLoc.l(:label_none), :value => 'none') +
|
||||
options_from_collection_for_select(Deliverable.find_all_by_project_id(context[:project].id, :order => 'subject ASC'), :id, :subject))
|
||||
|
||||
return help.content_tag(:p, "<label>#{GLoc.l(:field_deliverable)}: " + select + "</label>")
|
||||
return content_tag(:p, "<label>#{GLoc.l(:field_deliverable)}: " + select + "</label>")
|
||||
else
|
||||
return ''
|
||||
end
|
||||
@@ -55,7 +54,7 @@ class BudgetIssueHook < Redmine::Plugin::Hook::Base
|
||||
# * :issue => Issue being saved
|
||||
# * :params => HTML parameters
|
||||
#
|
||||
def self.issue_bulk_edit_save(context = { })
|
||||
def controller_issues_bulk_edit_before_save(context = { })
|
||||
case true
|
||||
|
||||
when context[:params][:deliverable_id].blank?
|
||||
@@ -76,7 +75,7 @@ class BudgetIssueHook < Redmine::Plugin::Hook::Base
|
||||
# Context:
|
||||
# * :detail => Detail about the journal change
|
||||
#
|
||||
def self.issue_helper_show_details(context = { })
|
||||
def helper_issues_show_detail_after_setting(context = { })
|
||||
# TODO Later: Overwritting the caller is bad juju
|
||||
if context[:detail].prop_key == 'deliverable_id'
|
||||
d = Deliverable.find_by_id(context[:detail].value)
|
||||
|
||||
Reference in new issue
Block a user