diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index bf68a67..f9240a6 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -346,6 +346,30 @@ module ApplicationHelper sex end + def profile_cat_icons( profile ) + if profile.class == Enterprise + icons = + profile.product_categories.map{ |c| c.size > 1 ? [c[0],c[1]] : nil }. + compact.uniq.map{ |c| + cat_name = (c[0]+'_'+c[1]).gsub( /\s/, '_' ) + cat_icon = "/images/icons-cat/#{cat_name}.png" + if ! File.exists? RAILS_ROOT.to_s() + '/public/' + cat_icon + cat_icon = '/images/icons-cat/undefined.png' + end + content_tag 'span', + content_tag( 'span', c.join(' → ') ), + :title => c.join(' → '), + :class => 'product-cat-icon cat_icon_' + cat_name, + :style => "background-image:url(#{cat_icon})" + }.join "\n" + content_tag 'div', + content_tag( 'span', _('Principal Product Categories'), :class => 'header' ) +"\n"+ icons, + :class => 'product-category-icons' + else + '' + end + end + # displays a link to the profile homepage with its image (as generated by # #profile_image) and its name below it. def profile_image_link( profile, size=:portrait, tag='li' ) @@ -360,7 +384,7 @@ module ApplicationHelper link_to( content_tag( 'span', profile_image( profile, size ), :class => 'profile-image' ) + content_tag( 'span', name, :class => ( profile.class == Person ? 'fn' : 'org' ) ) + - city + profile_sex_icon( profile ), + city + profile_sex_icon( profile ) + profile_cat_icons( 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/views/blocks/profile_info.rhtml b/app/views/blocks/profile_info.rhtml index dd6beee..de0bc95 100644 --- a/app/views/blocks/profile_info.rhtml +++ b/app/views/blocks/profile_info.rhtml @@ -7,12 +7,14 @@ <%= profile_image(block.owner, :thumb) +"\n"+ - profile_sex_icon( profile ) + profile_sex_icon( profile ) + + profile_cat_icons( profile ) %> +