download_block.rb
769 Bytes
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
class DownloadBlock < Block
attr_accessible :show_name, :downloads
settings_items :show_name, :type => :boolean, :default => false
settings_items :downloads, :type => Array, :default => []
validate :download_values
def download_values
self.downloads.each do |download|
if download[:name] == ""
downloads.delete(download)
end
end
end
def self.description
_('Download Stable Version')
end
def help
_('This block displays the stable version of a software.')
end
def content(args={})
block = self
s = show_name
lambda do |object|
render(
:file => 'blocks/download',
:locals => { :block => block, :show_name => s }
)
end
end
def cacheable?
false
end
end