%- def summarized_cost_entries(cost_entries) last_cost_type = "" result = cost_entries.sort_by(&:id).inject(Hash.new) do |result, entry| if entry.cost_type.id.to_s == last_cost_type result[last_cost_type][:units] += entry.units else last_cost_type = entry.cost_type.id.to_s result[last_cost_type] = {} result[last_cost_type][:units] = entry.units result[last_cost_type][:unit] = entry.cost_type.unit result[last_cost_type][:unit_plural] = entry.cost_type.unit_plural end result end return "-" if result.empty? str_array = [] options = {:class => 'icon icon-box'} result.each do |k, v| str_array << link_to(pluralize(v[:units], v[:unit], v[:unit_plural]), {:controller => 'costlog', :action => 'details', :project_id => @issue.project, :issue_id => @issue, :cost_type_id => k}, options) options = {} # options apply only for first element end str_array.join(", ") end -%> <% if @project.module_enabled? :costs_module %> <%# Only render this partial, if the plugin is enabled for the current project %>