Use method to initialize helper only ones

pull/6827/head
Hagen Schink 10 years ago
parent e24579d5b8
commit bbde57802e
  1. 8
      lib/open_project/costs/engine.rb

@ -121,15 +121,17 @@ module OpenProject::Costs
end end
send(:define_method, :spent_hours) do send(:define_method, :spent_hours) do
attributes_helper = OpenProject::Costs::AttributesHelper.new(represented.work_package) self.attributes_helper.time_entries_sum
attributes_helper.time_entries_sum
end end
send(:define_method, :current_user_allowed_to_view_spent_hours) do send(:define_method, :current_user_allowed_to_view_spent_hours) do
current_user_allowed_to(:view_time_entries, represented.work_package) || current_user_allowed_to(:view_time_entries, represented.work_package) ||
current_user_allowed_to(:view_own_time_entries, represented.work_package) current_user_allowed_to(:view_own_time_entries, represented.work_package)
end end
send(:define_method, :attributes_helper) do
@attributes_helper ||= OpenProject::Costs::AttributesHelper.new(represented.work_package)
end
end end
assets %w(costs/costs.css costs/costs.js) assets %w(costs/costs.css costs/costs.js)

Loading…
Cancel
Save