My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 115 attachment: child_tags_in_product_tag_list_view.diff (1.0 KB)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Index: plugins/substruct/app/models/tag.rb
===================================================================
--- plugins/substruct/app/models/tag.rb (revision 116)
+++ plugins/substruct/app/models/tag.rb (working copy)
@@ -58,4 +58,9 @@
def product_count
@cached_product_count ||= self.products.count
end
-end
\ No newline at end of file
+
+ # returns the number of child tags
+ def child_count
+ children.count
+ end
+end
Index: plugins/substruct/app/views/admin/products/_tag_list_view_item.rhtml
===================================================================
--- plugins/substruct/app/views/admin/products/_tag_list_view_item.rhtml (revision 116)
+++ plugins/substruct/app/views/admin/products/_tag_list_view_item.rhtml (working copy)
@@ -1,7 +1,7 @@
<% tag = tag_list_view_item %>
<li>
<%= render :partial => 'tag_text', :locals => { :tag => tag } %>
- <% if tag.product_count > 0 %>
+ <% if tag.child_count > 0 %>
<ul>
<% for child in tag.children do %>
<li><%= render :partial => 'tag_text', :locals => { :tag => child } %></li>
Powered by Google Project Hosting