From 149aa5b777a670096e8d5a8c8f9dd53aff28e0a1 Mon Sep 17 00:00:00 2001 From: AurelioAHeckert Date: Fri, 27 Jun 2008 01:49:56 +0000 Subject: [PATCH] ActionItem489: gender icons and location information in profile listing --- app/helpers/application_helper.rb | 21 ++++++++++++++++----- app/models/person.rb | 5 +++++ app/models/user.rb | 3 +-- public/images/icons-app/ico-female.png | Bin 0 -> 547 bytes public/images/icons-app/ico-male.png | Bin 0 -> 563 bytes public/images/icons-app/ico-sex-undef.png | Bin 0 -> 422 bytes public/img-source/sex.xcf.gz | Bin 0 -> 2167 bytes public/stylesheets/blocks/profile-list-block.css | 44 ++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 66 insertions(+), 7 deletions(-) create mode 100644 public/images/icons-app/ico-female.png create mode 100644 public/images/icons-app/ico-male.png create mode 100644 public/images/icons-app/ico-sex-undef.png create mode 100644 public/img-source/sex.xcf.gz diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c8a0800..1994c8b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -449,13 +449,24 @@ module ApplicationHelper # 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' ) - #link_to( '
'+ profile_image(profile, size) +'
'+ profile.name() +'', profile.url, - # :class => 'profile_link', - # :help => _('Click on this icon to go to the %s\'s home page') % profile.name ) + if profile.class == Person + sex = ( profile.sex ? profile.sex.to_s() : 'undef' ) + sex = content_tag( 'span', content_tag( 'span', sex ), :class => 'sex-' + sex ) + else + sex = '' + end + if profile.class == Person + name = profile.first_name + city = content_tag 'span', content_tag( 'span', profile.city, :class => 'locality' ), :class => 'adr' + else + name = profile.name + city = '' + end content_tag tag, link_to( - content_tag( 'span', profile_image(profile, size), :class => 'profile-image' ) + - content_tag( 'span', profile.name(), :class => ( profile.class == Person ? 'fn' : 'org' ) ), + content_tag( 'span', profile_image( profile, size ), :class => 'profile-image' ) + + content_tag( 'span', name, :class => ( profile.class == Person ? 'fn' : 'org' ) ) + + city + sex, 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/person.rb b/app/models/person.rb index 36d06c3..dca41bc 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -111,6 +111,11 @@ class Person < Profile end end + def first_name + re = '[-+*_\s\'´"]' + self.name.gsub(/^#{re}*/,'').split(/#{re}/)[0] + end + has_and_belongs_to_many :favorite_enterprises, :class_name => 'Enterprise', :join_table => 'favorite_enteprises_people' def email_addresses diff --git a/app/models/user.rb b/app/models/user.rb index 6107d07..cf79735 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -156,8 +156,7 @@ class User < ActiveRecord::Base end def first_name - re = '[-+*_\s\'´"]' - person.name.gsub(/^#{re}*/,'').split(/#{re}/)[0] + person.first_name end protected diff --git a/public/images/icons-app/ico-female.png b/public/images/icons-app/ico-female.png new file mode 100644 index 0000000..566bc8f Binary files /dev/null and b/public/images/icons-app/ico-female.png differ diff --git a/public/images/icons-app/ico-male.png b/public/images/icons-app/ico-male.png new file mode 100644 index 0000000..599cbb3 Binary files /dev/null and b/public/images/icons-app/ico-male.png differ diff --git a/public/images/icons-app/ico-sex-undef.png b/public/images/icons-app/ico-sex-undef.png new file mode 100644 index 0000000..b3f7b7c Binary files /dev/null and b/public/images/icons-app/ico-sex-undef.png differ diff --git a/public/img-source/sex.xcf.gz b/public/img-source/sex.xcf.gz new file mode 100644 index 0000000..cce3271 Binary files /dev/null and b/public/img-source/sex.xcf.gz differ diff --git a/public/stylesheets/blocks/profile-list-block.css b/public/stylesheets/blocks/profile-list-block.css index 67b6d9a..2a7ff7b 100644 --- a/public/stylesheets/blocks/profile-list-block.css +++ b/public/stylesheets/blocks/profile-list-block.css @@ -20,6 +20,7 @@ font-size: 11px; text-decoration: none; color: #000; + position: relative; } .msie6 .common-profile-list-block .vcard a { border: 2px solid #FFF; @@ -45,3 +46,46 @@ border: none; } +#content .common-profile-list-block .sex-male, +#content .common-profile-list-block .sex-female, +#content .common-profile-list-block .sex-undef { + position: absolute; + top: 2px; + right: 2px; + display: block; + width: 14px; + height: 18px; +} + +.common-profile-list-block .locality { + font-size: 9px; +} + +.common-profile-list-block .sex-male { + background: url(/images/icons-app/ico-male.png); +} +.common-profile-list-block .sex-female { + background: url(/images/icons-app/ico-female.png); +} +.common-profile-list-block .sex-undef { + background: url(/images/icons-app/ico-sex-undef.png); +} +.msie6 .common-profile-list-block .sex-male { + background: none; + filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/icons-app/ico-male.png',sizingMethod='scale'); +} +.msie6 .common-profile-list-block .sex-female { + background: none; + filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/icons-app/ico-female.png',sizingMethod='scale'); +} +.msie6 .common-profile-list-block .sex-undef { + background: none; + filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/icons-app/ico-sex-undef.png',sizingMethod='scale'); +} + +#content .common-profile-list-block .sex-male span, +#content .common-profile-list-block .sex-female span, +#content .common-profile-list-block .sex-undef span { + display: none; +} + -- libgit2 0.21.2