Commit
b74b1e3275a25fc3ff5179ddb8b08d55c91509ed
Exists in
master
and in
29 other branches
add_member_task_reject_details, admin_visible_profile, article-list-template, community_notifications, contact_admin_translation, event_fixes, fix_comments_pagination, fix_rails4_organization_ratings, fix_sign_up_form, follow_step_fix, forum_topic_creation, mirror_block_improvements, multi_env_on_remote_user, new_security, noosfero_spb_ci, organization_ratings_improvements, organization_ratings_link_to_profile_stable-spb-1.3, organization_ratings_translations_fix, profile_api_improvements, ratings_minor_fixes, remote_user_fix, send_email_to_admins, stable-spb-1.3, stable-spb-1.3-fixes, stable-spb-1.4, stable-spb-1.5, suggest_rejected_value, web_steps_improvements, xss_terminate_custom_options
ActionItem139: adding new implementation of "profile info" block
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1310 3f533792-8f58-4932-b0fe-aaf55b0a4547
|
| @@ -0,0 +1,14 @@ |
| @@ -0,0 +1,14 @@ |
|
| |
1
| +class ProfileInfoBlock < Block |
|
| |
2
| + |
|
| |
3
| + def self.description |
|
| |
4
| + _('Profile information block') |
|
| |
5
| + end |
|
| |
6
| + |
|
| |
7
| + def content |
|
| |
8
| + user = owner |
|
| |
9
| + lambda do |
|
| |
10
| + render :file => 'account/user_info', :locals => { :user => user } |
|
| |
11
| + end |
|
| |
12
| + end |
|
| |
13
| + |
|
| |
14
| +end |
|
| @@ -0,0 +1,7 @@ |
| @@ -0,0 +1,7 @@ |
|
| |
1
| +<h2><%= block.owner.name %></h2> |
|
| |
2
| + |
|
| |
3
| +<ul> |
|
| |
4
| + <li><%= _('Since %d') % block.owner.created_at.year %></li> |
|
| |
5
| + <li><%= link_to_homepage _('Homepage'), block.owner.url %></li> |
|
| |
6
| +</ul> |
|
| |
7
| + |
|
| @@ -0,0 +1,24 @@ |
| @@ -0,0 +1,24 @@ |
|
| |
1
| +require File.dirname(__FILE__) + '/../test_helper' |
|
| |
2
| + |
|
| |
3
| +class ProfileInfoBlockTest < Test::Unit::TestCase |
|
| |
4
| + |
|
| |
5
| + def setup |
|
| |
6
| + @profile = create_user('mytestuser').person |
|
| |
7
| + |
|
| |
8
| + @block = ProfileInfoBlock.new |
|
| |
9
| + @profile.boxes.first.blocks << @block |
|
| |
10
| + |
|
| |
11
| + @block.save! |
|
| |
12
| + end |
|
| |
13
| + attr_reader :block, :profile |
|
| |
14
| + |
|
| |
15
| + should 'provide description' do |
|
| |
16
| + assert_not_equal Block.description, ProfileInfoBlock.description |
|
| |
17
| + end |
|
| |
18
| + |
|
| |
19
| + should 'display profile information' do |
|
| |
20
| + self.expects(:render).with(:file => 'blocks/profile_info', :locals => { :block => block}) |
|
| |
21
| + instance_eval(& block.content) |
|
| |
22
| + end |
|
| |
23
| + |
|
| |
24
| +end |