OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/lib/costs_project_hook.rb

33 lines
1.2 KiB

class CostsProjectHook < Redmine::Hook::ViewListener
# Renders up to two additional table headers to the membership setting
#
# Context:
# * :project => Current project
#
def view_projects_settings_members_table_header(context={})
return unless context[:project] && context[:project].module_enabled?(:costs_module)
result = ""
user = User.current
project = context[:project]
result += content_tag(:th, l(:caption_current_rate)) if (user.allowed_to?(:view_all_rates, project) || user.allowed_to?(:view_own_rate, project))
result += content_tag(:th, l(:caption_set_rate)) if user.allowed_to?(:change_rates, project)
result
end
# Renders an AJAX form to update the member's billing rate
# Context:
# * :project => Current project
# * :member => Current Member record
render_on :view_projects_settings_members_table_row, :partial => 'hooks/view_projects_settings_members_table_row'
# Renders table headers to update the member's billing rate
# Context:
# * :project => Current project
render_on :view_projects_settings_members_table_header, :partial => 'hooks/view_projects_settings_members_table_header'
# TODO: implement model_project_copy_before_save
end