Patch #24587 » custom_fields_projects_count.diff
| app/controllers/custom_fields_controller.rb | ||
|---|---|---|
|
respond_to do |format|
|
||
|
format.html {
|
||
|
@custom_fields_by_type = CustomField.all.group_by {|f| f.class.name }
|
||
|
@custom_fields_projects_count =
|
||
|
IssueCustomField.where(is_for_all: false).joins(:projects).group(:custom_field_id).count
|
||
|
}
|
||
|
format.api {
|
||
|
@custom_fields = CustomField.all
|
||
| app/views/custom_fields/_index.html.erb | ||
|---|---|---|
|
<td><%= checked_image custom_field.is_required? %></td>
|
||
|
<% if tab[:name] == 'IssueCustomField' %>
|
||
|
<td><%= checked_image custom_field.is_for_all? %></td>
|
||
|
<td><%= l(:label_x_projects, :count => custom_field.projects.count) if custom_field.is_a? IssueCustomField and !custom_field.is_for_all? %></td>
|
||
|
<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>
|
||
|
<% end %>
|
||
|
<%= call_hook :view_custom_fields_table_data, :tab => tab, :custom_field => custom_field %>
|
||
|
<td class="buttons">
|
||