Class: Milkode::InfoHome

Inherits:
Object
  • Object
show all
Defined in:
lib/milkode/cdweb/lib/info_home.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(suburl) ⇒ InfoHome

Returns a new instance of InfoHome.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/milkode/cdweb/lib/info_home.rb', line 13

def initialize(suburl)
  packages       = Database.instance.packages(nil)

  @summary_content = <<EOF
<table class="table-striped table-bordered table-condensed">
  <tr><td>パッケージ数</td><td align="right">#{packages.size}</td></tr>
  <tr><td>ファイル数</td><td align="right">#{Database.instance.totalRecords}</td></tr>
</table>
EOF

  @record_content = packages.map do |name|
    "<dt class='result-file'><img src='#{suburl}/images/info.png'/><a href='#{suburl}/info/#{name}'>#{name}</a></dt>"
  end.join("\n")
end

Instance Attribute Details

#record_contentObject (readonly)

Returns the value of attribute record_content.



10
11
12
# File 'lib/milkode/cdweb/lib/info_home.rb', line 10

def record_content
  @record_content
end

#summary_contentObject (readonly)

Returns the value of attribute summary_content.



11
12
13
# File 'lib/milkode/cdweb/lib/info_home.rb', line 11

def summary_content
  @summary_content
end