Module CategoriesHelper
In: app/helpers/categories_helper.rb

Methods

Public Instance methods

[Source]

    # File app/helpers/categories_helper.rb, line 38
38:   def css_class_for(category)
39:     if m = category.name_es.match(/\"(.+)\":/)
40:       m[1].downcase.gsub(/[^a-z]/i, '')
41:     else
42:       category.name_es.downcase.gsub(/[^a-z]/i, '')
43:     end
44:   end

[Source]

    # File app/helpers/categories_helper.rb, line 17
17:   def link_to_category(category)
18:     cat_and_name = category_name_and_url(category)
19:     if cat_and_name[1].eql?('#')
20:       "<span>#{cat_and_name[0].sub(/\+$/, '')}</span>"
21:     else
22:       link_to h(cat_and_name[0]), cat_and_name[1]
23:     end
24:   end

[Source]

    # File app/helpers/categories_helper.rb, line 2
 2:   def menu_item_class(category, current_category, mark_ancestors=true)
 3:     output = "passive"
 4:     if current_category 
 5:       ancestor_ids = current_category.ancestors.collect(&:id)
 6:       if category.id == current_category.id 
 7:         return "active"
 8:       end
 9:       if mark_ancestors && ancestor_ids.include?(category.id) 
10:         return "active"
11:       end
12:     end
13:     return output
14:   end

[Source]

    # File app/helpers/categories_helper.rb, line 26
26:   def url_for_category(category)
27:     if match = category.name.match(/\"(.+)\":(.+$)/)
28:       if match[2].match("http://")
29:         match[2]
30:       else
31:         "http://" + request.host_with_port + match[2]
32:       end
33:     else
34:       category_url(category)
35:     end
36:   end

[Validate]