Commit 128fa31d020124da6e45c2b88e8a913499a74ed2

Authored by Leandro Santos
1 parent 13870552

removing profile_cat_icons

app/helpers/application_helper.rb
... ... @@ -503,32 +503,6 @@ module ApplicationHelper
503 503 sex
504 504 end
505 505  
506   - def profile_cat_icons( profile )
507   - if profile.class == Enterprise
508   - icons = profile.product_categories.unique_by_level(2).limit(3).map do |c|
509   - filtered_category = c.filtered_category.blank? ? c.path.split('/').last : c.filtered_category
510   - category_title = filtered_category.split(/[-_\s,.;'"]+/).map(&:capitalize).join(' ')
511   - category_name = category_title.gsub(' ', '_' )
512   - category_icon = "/images/icons-cat/#{category_name}.png"
513   - if ! File.exists?(Rails.root.join('public', category_icon))
514   - category_icon = '/images/icons-cat/undefined.png'
515   - end
516   - content_tag('span',
517   - content_tag( 'span', category_title ),
518   - :title => category_title,
519   - :class => 'product-cat-icon cat_icon_' + category_name,
520   - :style => "background-image:url(#{category_icon})"
521   - )
522   - end.join("\n").html_safe
523   - content_tag('div',
524   - content_tag( 'span', _('Principal Product Categories'), :class => 'header' ) +"\n"+ icons,
525   - :class => 'product-category-icons'
526   - )
527   - else
528   - ''
529   - end
530   - end
531   -
532 506 def links_for_balloon(profile)
533 507 if environment.enabled?(:show_balloon_with_profile_links_when_clicked)
534 508 if profile.kind_of?(Person)
... ... @@ -587,7 +561,7 @@ module ApplicationHelper
587 561 link_to(
588 562 content_tag( 'span', profile_image( profile, size ), :class => 'profile-image' ) +
589 563 content_tag( 'span', h(name), :class => ( profile.class == Person ? 'fn' : 'org' ) ) +
590   - extra_info + profile_sex_icon( profile ) + profile_cat_icons( profile ),
  564 + extra_info + profile_sex_icon( profile ),
591 565 profile.url,
592 566 :class => 'profile_link url',
593 567 :help => _('Click on this icon to go to the <b>%s</b>\'s home page') % profile.name,
... ...
app/models/product_category.rb
... ... @@ -13,9 +13,6 @@ class ProductCategory &lt; Category
13 13 scope :by_environment, -> environment {
14 14 where 'environment_id = ?', environment.id
15 15 }
16   - scope :unique_by_level, -> level {
17   - select "DISTINCT ON (filtered_category) split_part(path, '/', #{level}) AS filtered_category, categories.*"
18   - }
19 16  
20 17 def all_products
21 18 Product.where(product_category_id: (all_children << self).map(&:id))
... ...
app/views/blocks/profile_info.html.erb
... ... @@ -7,8 +7,7 @@
7 7 <span class="profile-info-picture-inner2">
8 8 <%=
9 9 profile_image(block.owner, :thumb) +"\n"+
10   - profile_sex_icon( profile ) +
11   - profile_cat_icons( profile )
  10 + profile_sex_icon( profile )
12 11 %>
13 12 </span>
14 13 </div>
... ...
test/unit/product_category_test.rb
... ... @@ -85,14 +85,4 @@ class ProductCategoryTest &lt; ActiveSupport::TestCase
85 85 assert_equivalent [c1,c3], ProductCategory.by_environment(Environment.default)
86 86 end
87 87  
88   - should 'fetch unique categories by level' do
89   - c1 = ProductCategory.create!(:name => 'test cat 1', :environment => Environment.default)
90   - c11 = ProductCategory.create!(:name => 'test cat 11', :environment => Environment.default, :parent => c1)
91   - c12 = ProductCategory.create!(:name => 'test cat 12', :environment => Environment.default, :parent => c1)
92   - c111 = ProductCategory.create!(:name => 'test cat 111', :environment => Environment.default, :parent => c11)
93   - c112 = ProductCategory.create!(:name => 'test cat 112', :environment => Environment.default, :parent => c11)
94   -
95   - assert_equivalent ['', 'test-cat-11', 'test-cat-12'], ProductCategory.unique_by_level(2).map(&:filtered_category)
96   - end
97   -
98 88 end
... ...