Commit 0f14fca1b3ae3d97a651936a8d24dbb1f1e10907
1 parent
36b2b195
Exists in
software_as_organization
adjust category extension
Showing
2 changed files
with
4 additions
and
8 deletions
Show diff stats
src/noosfero-spb/software_communities/lib/ext/category.rb
... | ... | @@ -18,6 +18,8 @@ class Category |
18 | 18 | _('Transportation and Transit') |
19 | 19 | ] |
20 | 20 | |
21 | + has_many :softwares, :through => :profile_categorizations, :source => :profile, :class_name => 'Software' | |
22 | + | |
21 | 23 | scope :software_categories, lambda { |
22 | 24 | software_category = Category.find_by_name("Software") |
23 | 25 | if software_category.nil? |
... | ... | @@ -26,10 +28,4 @@ class Category |
26 | 28 | software_category.children |
27 | 29 | end |
28 | 30 | } |
29 | - | |
30 | - def software_infos | |
31 | - software_list = self.communities | |
32 | - software_list.collect { |x| software_list.delete(x) unless x.software? } | |
33 | - software_list | |
34 | - end | |
35 | 31 | end | ... | ... |
src/noosfero-spb/software_communities/views/blocks/categories_software.html.erb
... | ... | @@ -9,8 +9,8 @@ |
9 | 9 | <ul class="categories-mais-software"> |
10 | 10 | |
11 | 11 | <% categories.each do |category| %> |
12 | - <% unless category.software_infos.count < 1 %> | |
13 | - <li><%= link_to _("#{category.name}") + " (#{category.software_infos.count})", {:controller => :search, :action => :software_infos, :selected_categories_id => [category.id]} %></li> | |
12 | + <% unless category.softwares.count < 1 %> | |
13 | + <li><%= link_to _("#{category.name}") + " (#{category.softwares.count})", {:controller => :search, :action => :software_infos, :selected_categories_id => [category.id]} %></li> | |
14 | 14 | <% end %> |
15 | 15 | <% end %> |
16 | 16 | </ul> | ... | ... |