diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 2d116d6..4789429 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -503,32 +503,6 @@ module ApplicationHelper
sex
end
- def profile_cat_icons( profile )
- if profile.class == Enterprise
- icons = profile.product_categories.unique_by_level(2).limit(3).map do |c|
- filtered_category = c.filtered_category.blank? ? c.path.split('/').last : c.filtered_category
- category_title = filtered_category.split(/[-_\s,.;'"]+/).map(&:capitalize).join(' ')
- category_name = category_title.gsub(' ', '_' )
- category_icon = "/images/icons-cat/#{category_name}.png"
- if ! File.exists?(Rails.root.join('public', category_icon))
- category_icon = '/images/icons-cat/undefined.png'
- end
- content_tag('span',
- content_tag( 'span', category_title ),
- :title => category_title,
- :class => 'product-cat-icon cat_icon_' + category_name,
- :style => "background-image:url(#{category_icon})"
- )
- end.join("\n").html_safe
- content_tag('div',
- content_tag( 'span', _('Principal Product Categories'), :class => 'header' ) +"\n"+ icons,
- :class => 'product-category-icons'
- )
- else
- ''
- end
- end
-
def links_for_balloon(profile)
if environment.enabled?(:show_balloon_with_profile_links_when_clicked)
if profile.kind_of?(Person)
@@ -587,7 +561,7 @@ module ApplicationHelper
link_to(
content_tag( 'span', profile_image( profile, size ), :class => 'profile-image' ) +
content_tag( 'span', h(name), :class => ( profile.class == Person ? 'fn' : 'org' ) ) +
- extra_info + profile_sex_icon( profile ) + profile_cat_icons( profile ),
+ extra_info + profile_sex_icon( profile ),
profile.url,
:class => 'profile_link url',
:help => _('Click on this icon to go to the %s\'s home page') % profile.name,
diff --git a/app/models/product_category.rb b/app/models/product_category.rb
index 4039b88..e880323 100644
--- a/app/models/product_category.rb
+++ b/app/models/product_category.rb
@@ -13,9 +13,6 @@ class ProductCategory < Category
scope :by_environment, -> environment {
where 'environment_id = ?', environment.id
}
- scope :unique_by_level, -> level {
- select "DISTINCT ON (filtered_category) split_part(path, '/', #{level}) AS filtered_category, categories.*"
- }
def all_products
Product.where(product_category_id: (all_children << self).map(&:id))
diff --git a/app/views/blocks/profile_info.html.erb b/app/views/blocks/profile_info.html.erb
index 0595b86..39025a6 100644
--- a/app/views/blocks/profile_info.html.erb
+++ b/app/views/blocks/profile_info.html.erb
@@ -7,8 +7,7 @@
<%=
profile_image(block.owner, :thumb) +"\n"+
- profile_sex_icon( profile ) +
- profile_cat_icons( profile )
+ profile_sex_icon( profile )
%>
diff --git a/test/unit/product_category_test.rb b/test/unit/product_category_test.rb
index 6973558..766f7bb 100644
--- a/test/unit/product_category_test.rb
+++ b/test/unit/product_category_test.rb
@@ -85,14 +85,4 @@ class ProductCategoryTest < ActiveSupport::TestCase
assert_equivalent [c1,c3], ProductCategory.by_environment(Environment.default)
end
- should 'fetch unique categories by level' do
- c1 = ProductCategory.create!(:name => 'test cat 1', :environment => Environment.default)
- c11 = ProductCategory.create!(:name => 'test cat 11', :environment => Environment.default, :parent => c1)
- c12 = ProductCategory.create!(:name => 'test cat 12', :environment => Environment.default, :parent => c1)
- c111 = ProductCategory.create!(:name => 'test cat 111', :environment => Environment.default, :parent => c11)
- c112 = ProductCategory.create!(:name => 'test cat 112', :environment => Environment.default, :parent => c11)
-
- assert_equivalent ['', 'test-cat-11', 'test-cat-12'], ProductCategory.unique_by_level(2).map(&:filtered_category)
- end
-
end
--
libgit2 0.21.2