Patch #24587 » custom_fields_projects_count.diff
app/controllers/custom_fields_controller.rb | ||
---|---|---|
27 | 27 |
respond_to do |format| |
28 | 28 |
format.html { |
29 | 29 |
@custom_fields_by_type = CustomField.all.group_by {|f| f.class.name } |
30 |
@custom_fields_projects_count = |
|
31 |
IssueCustomField.where(is_for_all: false).joins(:projects).group(:custom_field_id).count |
|
30 | 32 |
} |
31 | 33 |
format.api { |
32 | 34 |
@custom_fields = CustomField.all |
app/views/custom_fields/_index.html.erb | ||
---|---|---|
19 | 19 |
<td><%= checked_image custom_field.is_required? %></td> |
20 | 20 |
<% if tab[:name] == 'IssueCustomField' %> |
21 | 21 |
<td><%= checked_image custom_field.is_for_all? %></td> |
22 |
<td><%= l(:label_x_projects, :count => custom_field.projects.count) if custom_field.is_a? IssueCustomField and !custom_field.is_for_all? %></td>
|
|
22 |
<td><%= l(:label_x_projects, :count => @custom_fields_projects_count[custom_field.id]) if custom_field.is_a? IssueCustomField and !custom_field.is_for_all? %></td>
|
|
23 | 23 |
<% end %> |
24 | 24 |
<%= call_hook :view_custom_fields_table_data, :tab => tab, :custom_field => custom_field %> |
25 | 25 |
<td class="buttons"> |