profile_fields_block.rb
1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
class ProfileFieldsBlock < Block
settings_items :profile_description, :type => :string, :default => ""
settings_items :show_name, :type => :boolean, :default => false
attr_accessor :show_name
def self.description
_('Profile Fields ')
end
def profile_description
self.settings[:profile_description]
end
def help
_('This block display the description of the community')
end
def content(args={})
self.profile_description = retrive_description_profile_field
block_content = self.profile_description
block = self
s = show_name
lambda do |object|
render(
:file => 'blocks/profile_fields',
:locals => { :block => block, :show_name => s ,
:description => block_content}
)
end
end
def cacheable?
false
end
private
def retrive_description_profile_field
box_id = self.box_id
owner_id = Box.find(box_id).owner_id
description = Profile.find(owner_id).description
if description.blank?
"Description field are empty or
not enabled in enviroment"
else
description
end
end
end