recent_documents_block.rb
1.03 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
class RecentDocumentsBlock < Block
def self.description
_('Display the last content produced in the context where the block is available.')
end
def self.short_description
_('Show last updates')
end
def self.pretty_name
_('Recent Content')
end
def default_title
_('Recent content')
end
def help
_('This block lists your content most recently updated.')
end
settings_items :limit, :type => :integer, :default => 5
def content(args={})
block = self
proc do
render :file => 'blocks/recent_documents', :locals => { :block => block }
end
end
def footer
return nil unless self.owner.is_a?(Profile)
profile = self.owner
proc do
link_to _('All content'), :profile => profile.identifier, :controller => 'profile', :action => 'sitemap'
end
end
def docs
self.limit.nil? ? owner.recent_documents(nil, {}, false) : owner.recent_documents(self.get_limit, {}, false)
end
def self.expire_on
{ :profile => [:article], :environment => [:article] }
end
end