Commit 149aa5b777a670096e8d5a8c8f9dd53aff28e0a1

Authored by AurelioAHeckert
1 parent 3d54fa67

ActionItem489: gender icons and location information in profile listing

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2100 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/helpers/application_helper.rb
@@ -449,13 +449,24 @@ module ApplicationHelper @@ -449,13 +449,24 @@ module ApplicationHelper
449 # displays a link to the profile homepage with its image (as generated by 449 # displays a link to the profile homepage with its image (as generated by
450 # #profile_image) and its name below it. 450 # #profile_image) and its name below it.
451 def profile_image_link( profile, size=:portrait, tag='li' ) 451 def profile_image_link( profile, size=:portrait, tag='li' )
452 - #link_to( '<div>'+ profile_image(profile, size) +'</div><span>'+ profile.name() +'</span>', profile.url,  
453 - # :class => 'profile_link',  
454 - # :help => _('Click on this icon to go to the <b>%s</b>\'s home page') % profile.name ) 452 + if profile.class == Person
  453 + sex = ( profile.sex ? profile.sex.to_s() : 'undef' )
  454 + sex = content_tag( 'span', content_tag( 'span', sex ), :class => 'sex-' + sex )
  455 + else
  456 + sex = ''
  457 + end
  458 + if profile.class == Person
  459 + name = profile.first_name
  460 + city = content_tag 'span', content_tag( 'span', profile.city, :class => 'locality' ), :class => 'adr'
  461 + else
  462 + name = profile.name
  463 + city = ''
  464 + end
455 content_tag tag, 465 content_tag tag,
456 link_to( 466 link_to(
457 - content_tag( 'span', profile_image(profile, size), :class => 'profile-image' ) +  
458 - content_tag( 'span', profile.name(), :class => ( profile.class == Person ? 'fn' : 'org' ) ), 467 + content_tag( 'span', profile_image( profile, size ), :class => 'profile-image' ) +
  468 + content_tag( 'span', name, :class => ( profile.class == Person ? 'fn' : 'org' ) ) +
  469 + city + sex,
459 profile.url, 470 profile.url,
460 :class => 'profile_link url', 471 :class => 'profile_link url',
461 :help => _('Click on this icon to go to the <b>%s</b>\'s home page') % profile.name ), 472 :help => _('Click on this icon to go to the <b>%s</b>\'s home page') % profile.name ),
app/models/person.rb
@@ -111,6 +111,11 @@ class Person &lt; Profile @@ -111,6 +111,11 @@ class Person &lt; Profile
111 end 111 end
112 end 112 end
113 113
  114 + def first_name
  115 + re = '[-+*_\s\'´"]'
  116 + self.name.gsub(/^#{re}*/,'').split(/#{re}/)[0]
  117 + end
  118 +
114 has_and_belongs_to_many :favorite_enterprises, :class_name => 'Enterprise', :join_table => 'favorite_enteprises_people' 119 has_and_belongs_to_many :favorite_enterprises, :class_name => 'Enterprise', :join_table => 'favorite_enteprises_people'
115 120
116 def email_addresses 121 def email_addresses
app/models/user.rb
@@ -156,8 +156,7 @@ class User &lt; ActiveRecord::Base @@ -156,8 +156,7 @@ class User &lt; ActiveRecord::Base
156 end 156 end
157 157
158 def first_name 158 def first_name
159 - re = '[-+*_\s\'´"]'  
160 - person.name.gsub(/^#{re}*/,'').split(/#{re}/)[0] 159 + person.first_name
161 end 160 end
162 161
163 protected 162 protected
public/images/icons-app/ico-female.png 0 → 100644

547 Bytes

public/images/icons-app/ico-male.png 0 → 100644

563 Bytes

public/images/icons-app/ico-sex-undef.png 0 → 100644

422 Bytes

public/img-source/sex.xcf.gz 0 → 100644
No preview for this file type
public/stylesheets/blocks/profile-list-block.css
@@ -20,6 +20,7 @@ @@ -20,6 +20,7 @@
20 font-size: 11px; 20 font-size: 11px;
21 text-decoration: none; 21 text-decoration: none;
22 color: #000; 22 color: #000;
  23 + position: relative;
23 } 24 }
24 .msie6 .common-profile-list-block .vcard a { 25 .msie6 .common-profile-list-block .vcard a {
25 border: 2px solid #FFF; 26 border: 2px solid #FFF;
@@ -45,3 +46,46 @@ @@ -45,3 +46,46 @@
45 border: none; 46 border: none;
46 } 47 }
47 48
  49 +#content .common-profile-list-block .sex-male,
  50 +#content .common-profile-list-block .sex-female,
  51 +#content .common-profile-list-block .sex-undef {
  52 + position: absolute;
  53 + top: 2px;
  54 + right: 2px;
  55 + display: block;
  56 + width: 14px;
  57 + height: 18px;
  58 +}
  59 +
  60 +.common-profile-list-block .locality {
  61 + font-size: 9px;
  62 +}
  63 +
  64 +.common-profile-list-block .sex-male {
  65 + background: url(/images/icons-app/ico-male.png);
  66 +}
  67 +.common-profile-list-block .sex-female {
  68 + background: url(/images/icons-app/ico-female.png);
  69 +}
  70 +.common-profile-list-block .sex-undef {
  71 + background: url(/images/icons-app/ico-sex-undef.png);
  72 +}
  73 +.msie6 .common-profile-list-block .sex-male {
  74 + background: none;
  75 + filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/icons-app/ico-male.png',sizingMethod='scale');
  76 +}
  77 +.msie6 .common-profile-list-block .sex-female {
  78 + background: none;
  79 + filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/icons-app/ico-female.png',sizingMethod='scale');
  80 +}
  81 +.msie6 .common-profile-list-block .sex-undef {
  82 + background: none;
  83 + filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/icons-app/ico-sex-undef.png',sizingMethod='scale');
  84 +}
  85 +
  86 +#content .common-profile-list-block .sex-male span,
  87 +#content .common-profile-list-block .sex-female span,
  88 +#content .common-profile-list-block .sex-undef span {
  89 + display: none;
  90 +}
  91 +