Commit
b74b1e3275a25fc3ff5179ddb8b08d55c91509ed
Exists in
staging
and in
42 other branches
all_pending_tasks_api, api-articles-period, api_roles, caching-rails4, captcha_serpro_plugin, comments_permissions, content-manager-hostspot, elasticsearch, elasticsearch_api, elasticsearch_categories, elasticsearch_filter, elasticsearch_sort, elasticsearch_to_merge, elasticsearch_view, environment-exposes-api, export-comment-api, export-comment-paragraph, export_data, external_followers, federation-webfinger, federation_followers, federation_followers_backend, federation_oauth_provider, federation_webfinger, fix_event_date_issue, fix_notification_email, fix_string_downcase_and_upcase, follower_permition, json_cookie_serializer, login-captcha, master, master_profile_followers, oauth_external_login, oauth_login, private-scraps, private-scraps-rebase, production, production-vendorized, profile_api_improvements, tasks_keep_filter_params, user_mention, webfinger_server
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 |