Don't use hooks if the project doesn't have the module enabled. #1300
This commit is contained in:
1 parent
8295b737a1
commit
ab67d20fcf
2 files changed
+46
-28
No files matched your search
+25
-19
@@ -6,7 +6,11 @@ class BudgetProjectHook < Redmine::Plugin::Hook::Base
|
||||
#
|
||||
# Context: none
|
||||
def self.member_list_header(context ={ })
|
||||
return "<th>#{GLoc.l(:label_member_rate) }</th>"
|
||||
if context[:project].module_enabled?('budget_module')
|
||||
return "<th>#{GLoc.l(:label_member_rate) }</th>"
|
||||
else
|
||||
return ''
|
||||
end
|
||||
end
|
||||
|
||||
# Renders an AJAX from to update the member's billing rate
|
||||
@@ -15,23 +19,25 @@ class BudgetProjectHook < Redmine::Plugin::Hook::Base
|
||||
# * :member => Current Member record
|
||||
#
|
||||
def self.member_list_column_three(context = { })
|
||||
|
||||
# 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, :host => Setting.host_name},
|
||||
:onsubmit => help.remote_function(:url => {
|
||||
:controller => 'members',
|
||||
:action => 'edit',
|
||||
:id => context[:member].id,
|
||||
:host => Setting.host_name
|
||||
},
|
||||
:host => Setting.host_name,
|
||||
: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>"
|
||||
|
||||
return help.content_tag(:td, form, :align => 'center' )
|
||||
|
||||
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, :host => Setting.host_name},
|
||||
:onsubmit => help.remote_function(:url => {
|
||||
:controller => 'members',
|
||||
:action => 'edit',
|
||||
:id => context[:member].id,
|
||||
:host => Setting.host_name
|
||||
},
|
||||
:host => Setting.host_name,
|
||||
: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>"
|
||||
|
||||
return help.content_tag(:td, form, :align => 'center' )
|
||||
else
|
||||
return ''
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user