Permalink
Browse files

fixes #2 (Summary line displayed regardless user permissions)

  • Loading branch information...
1 parent 4a2f5a7 commit 6da1dbf7fc0f09218336e47a34870358d5f47df8 Jan Schulz-Hofen committed Aug 5, 2011
Showing with 13 additions and 5 deletions.
  1. +13 −5 app/views/hooks/redmine_spent_time_column/_view_issues_index_bottom.html.erb
@@ -1,19 +1,27 @@
<%
+ allowed_to_view_time_entries = true
estimated_hours = spent_hours = calculated_spent_hours = divergent_hours = remaining_hours = 0.0
@issues.each do |issue|
- estimated_hours += issue.estimated_hours ||0.0
- spent_hours += issue.spent_hours ||0.0
- calculated_spent_hours += issue.calculated_spent_hours ||0.0
- divergent_hours += issue.divergent_hours ||0.0
- remaining_hours += issue.remaining_hours ||0.0
+ if User.current.allowed_to?(:view_time_entries, issue.project)
+ estimated_hours += issue.estimated_hours ||0.0
+ spent_hours += issue.spent_hours ||0.0
+ calculated_spent_hours += issue.calculated_spent_hours ||0.0
+ divergent_hours += issue.divergent_hours ||0.0
+ remaining_hours += issue.remaining_hours ||0.0
+ else
+ allowed_to_view_time_entries = false if not User.current.admin?
+ break
+ end
end
%>
+<% if allowed_to_view_time_entries -%>
<p class="other-formats">
<strong><%= t :field_estimated_hours %>:</strong> <%= estimated_hours.round(2) %>,
<strong><%= t :label_spent_time %>:</strong> <%= spent_hours.round(2) %>,
<strong><%= t :label_calculated_spent_hours %>:</strong> <%= calculated_spent_hours.round(2) %>,
<strong><%= t :label_divergent_hours %>:</strong> <%= divergent_hours.round(2) %>,
<strong><%= t :label_remaining_hours %>:</strong> <%= remaining_hours.round(2) %>
</p>
+<% end -%>

0 comments on commit 6da1dbf

Please sign in to comment.