Commit bcc456c341250cfb6969add68ec10dc5e54b55c6
1 parent
7c02128a
Exists in
master
and in
3 other branches
Order categories in categories_software_block
Showing
2 changed files
with
9 additions
and
7 deletions
Show diff stats
lib/categories_software_block.rb
@@ -16,10 +16,15 @@ class CategoriesSoftwareBlock < Block | @@ -16,10 +16,15 @@ class CategoriesSoftwareBlock < Block | ||
16 | def content(args={}) | 16 | def content(args={}) |
17 | block = self | 17 | block = self |
18 | s = show_name | 18 | s = show_name |
19 | + | ||
20 | + software_category = Category.find_by_name("Software") | ||
21 | + categories = [] | ||
22 | + categories = software_category.children.sort if software_category | ||
23 | + | ||
19 | lambda do |object| | 24 | lambda do |object| |
20 | render( | 25 | render( |
21 | :file => 'blocks/categories_software', | 26 | :file => 'blocks/categories_software', |
22 | - :locals => { :block => block, :show_name => s } | 27 | + :locals => { :block => block, :show_name => s, :categories => categories } |
23 | ) | 28 | ) |
24 | end | 29 | end |
25 | end | 30 | end |
views/blocks/categories_software.html.erb
@@ -8,12 +8,9 @@ | @@ -8,12 +8,9 @@ | ||
8 | <p><%= _("Categories:") %></p> | 8 | <p><%= _("Categories:") %></p> |
9 | <ul class="categories-mais-software"> | 9 | <ul class="categories-mais-software"> |
10 | 10 | ||
11 | - <% categories = Category.where(:name => "Software") %> | ||
12 | - <% unless categories.blank? %> | ||
13 | - <% categories.first.children.each do |category| %> | ||
14 | - <% unless category.software_infos.count < 1 %> | ||
15 | - <li><%= link_to _("#{category.name}") + " (#{category.software_infos.count})", {:controller => :search, :action => :software_infos, :selected_categories_id => [category.id]} %></li> | ||
16 | - <% end %> | 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> | ||
17 | <% end %> | 14 | <% end %> |
18 | <% end %> | 15 | <% end %> |
19 | </ul> | 16 | </ul> |