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
-10
@@ -1,11 +1,14 @@
|
||||
# Hooks to attach to the Redmine Projects. They are attached in init.rb by the
|
||||
# +add_hook+ method
|
||||
class BudgetProjectHook < Redmine::Plugin::Hook::Base
|
||||
# Hooks to attach to the Redmine Projects.
|
||||
class BudgetProjectHook < Redmine::Hook::ViewListener
|
||||
|
||||
def protect_against_forgery?
|
||||
false
|
||||
end
|
||||
|
||||
# Renders an additional table header to the membership setting
|
||||
#
|
||||
# Context: none
|
||||
def self.member_list_header(context ={ })
|
||||
def view_projects_settings_members_table_header(context ={ })
|
||||
if context[:project].module_enabled?('budget_module')
|
||||
return "<th>#{GLoc.l(:label_member_rate) }</th>"
|
||||
else
|
||||
@@ -18,11 +21,11 @@ class BudgetProjectHook < Redmine::Plugin::Hook::Base
|
||||
# Context:
|
||||
# * :member => Current Member record
|
||||
#
|
||||
def self.member_list_column_three(context = { })
|
||||
def view_projects_settings_members_table_row(context = { })
|
||||
if context[:project].module_enabled?('budget_module')
|
||||
# Build a form_remote_tag by hand since this isn't in the scope of a controller
|
||||
form = help.form_tag({:controller => 'members', :action => 'edit', :id => context[:member].id, :protocol => Setting.protocol, :host => Setting.host_name},
|
||||
:onsubmit => help.remote_function(:url => {
|
||||
form = form_tag({:controller => 'members', :action => 'edit', :id => context[:member].id, :protocol => Setting.protocol, :host => Setting.host_name},
|
||||
:onsubmit => remote_function(:url => {
|
||||
:controller => 'members',
|
||||
:action => 'edit',
|
||||
:id => context[:member].id,
|
||||
@@ -34,10 +37,10 @@ class BudgetProjectHook < Redmine::Plugin::Hook::Base
|
||||
:form => true,
|
||||
:method => 'post',
|
||||
:return => 'false' )+ '; return false;') +
|
||||
help.text_field_tag('member[rate]', help.number_with_precision(context[:member].rate, 0), :class => "small") +
|
||||
help.submit_tag(GLoc.l(:button_change), :class => "small") + "</form>"
|
||||
text_field_tag('member[rate]', number_with_precision(context[:member].rate, 0), :class => "small") +
|
||||
submit_tag(GLoc.l(:button_change), :class => "small") + "</form>"
|
||||
|
||||
return help.content_tag(:td, form, :align => 'center' )
|
||||
return content_tag(:td, form, :align => 'center' )
|
||||
else
|
||||
return ''
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user