lib/milkode/cdweb/lib/info_package.rb in milkode-1.0.2 vs lib/milkode/cdweb/lib/info_package.rb in milkode-1.1.0
- old
+ new
@@ -12,11 +12,13 @@
module Milkode
class InfoPackage
attr_reader :summary_content
attr_reader :plang_content
- def initialize(name)
+ def initialize(name, suburl)
+ @suburl = suburl
+
records = Database.instance.package_records(name)
# plangs = sorted_plangs(records)
@summary_content = <<EOF
<table class="table-striped table-bordered table-condensed">
@@ -52,10 +54,10 @@
percent = (count.to_f / records.size * 100).to_i
params = { :query => lang_to_query(lang) }
if params[:query] != ""
- url = "/home/" + Mkurl.new(package_name, params).inherit_query_shead
+ url = @suburl + "/home/" + Mkurl.new(package_name, params).inherit_query_shead
"<tr><td>#{name}</td><td align=\"right\"><a href=\"#{url}\">#{count}</a></td><td align=\"right\">#{percent}%</td></tr>"
else
"<tr><td>#{name}</td><td align=\"right\">#{count}</td><td align=\"right\">#{percent}%</td></tr>"
end
}.join("\n")