diff options
author | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2009-11-24 20:39:56 +0100 |
---|---|---|
committer | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2009-11-24 20:39:56 +0100 |
commit | efd838d9ac1112d3d4cd8bb64951b417a977f4b2 (patch) | |
tree | d49990669ef3ec20ac6bb89710518021e6f32901 /timepollhead.rb | |
parent | 4279e3023c4f437cd4fb996e0535fe09241823cf (diff) |
give sort feedback
Diffstat (limited to 'timepollhead.rb')
-rw-r--r-- | timepollhead.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/timepollhead.rb b/timepollhead.rb index 4b4d619..4521f26 100644 --- a/timepollhead.rb +++ b/timepollhead.rb @@ -172,7 +172,7 @@ class TimePollHead } ret.sort end - def to_html(config = false,activecolumn = nil) + def to_html(scols,config = false,activecolumn = nil) ret = "<tr><td></td>" head_count("%Y-%m",false).each{|title,count| year, month = title.split("-").collect{|e| e.to_i} @@ -183,11 +183,16 @@ class TimePollHead head_count("%Y-%m-%d",false).each{|title,count| ret += "<th colspan='#{count}'>#{Date.parse(title).strftime("%a, %d")}</th>\n" } - ret += "</tr><tr><th><a href='?sort=name'>Name #{NOSORT}</a></th>" + + def sortsymb(scols,col) + scols.include?(col) ? SORT : NOSORT + end + + ret += "</tr><tr><th><a href='?sort=name'>Name #{sortsymb(scols,"name")}</a></th>" @data.sort.each{|date| - ret += "<th><a title='#{date}' href='?sort=#{CGI.escape(date.to_s + " ")}'>#{date.time_to_s} #{NOSORT}</a></th>\n" + ret += "<th><a title='#{date}' href='?sort=#{CGI.escape(date.to_s + " ")}'>#{date.time_to_s} #{sortsymb(scols,date.to_s + " ")}</a></th>\n" } - ret += "<th><a href='.'>Last Edit #{NOSORT}</a></th>\n</tr>\n" + ret += "<th><a href='?'>Last Edit #{sortsymb(scols,"timestamp")}</a></th>\n</tr>\n" ret end |