Skip to content

Commit d94ade3

Browse files
Fix catalog item tags
1 parent beeaaed commit d94ade3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

app/helpers/catalog_helper/textual_summary.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module CatalogHelper::TextualSummary
22
def tags_from_record
33
tags = []
4+
tag_categories = {}
45
@record.tags.each do |tag|
56
values = tag.name.split('/')
67
p = tags.find { |x| x[:label] == values[2].humanize }
@@ -9,9 +10,16 @@ def tags_from_record
910
p[:value].push(value)
1011
else
1112
name = Classification.find_by(:id => Classification.find_by(:tag_id => tag.id).parent_id).description
12-
tags.push(:icon => "fa fa-tag", :label => name, :value => [value])
13+
if tag_categories[name].nil?
14+
tag_categories[name] = [value]
15+
else
16+
tag_categories[name].append(value)
17+
end
1318
end
1419
end
20+
tag_categories.each do |tag_category, tag_values|
21+
tags.push(:icon => "fa fa-tag", :label => tag_category, :value => tag_values)
22+
end
1523
tags
1624
end
1725

0 commit comments

Comments
 (0)