summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormguetlein <martin.guetlein@gmail.com>2012-10-24 14:50:31 +0200
committermguetlein <martin.guetlein@gmail.com>2012-10-24 14:50:31 +0200
commita45a8e727a23b7af637c4f495ee8494df3c708d5 (patch)
tree36c1ea103e7f4188a8344ef00d0c1acf0b620ddf
parent38af51be6b4fdb4c2505382a9b9f6b0e61592641 (diff)
add html view for latest taskval_exp
-rw-r--r--application.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/application.rb b/application.rb
index 369bf17..8d09aa5 100644
--- a/application.rb
+++ b/application.rb
@@ -67,7 +67,6 @@ get '/?' do
end
get '/latest' do
- response['Content-Type'] = 'text/plain'
ts = Task.all.sort
running = []
ts.size.times do |i|
@@ -80,7 +79,14 @@ get '/latest' do
end
running.reverse!
running << ts[-1] if running.size==nil or running[-1]!=ts[-1]
- running.collect{|t| "'#{t.uri}' --- '#{t.created_at}' --- '#{t.hasStatus}' --- '#{t.title}'"}.join("\n")+"\n"
+ res = running.collect{|t| "'#{t.uri}' --- '#{t.created_at}' --- '#{t.hasStatus}' --- '#{t.title}'"}.join("\n")+"\n"
+ if request.env['HTTP_ACCEPT'] =~ /html/
+ response['Content-Type'] = 'text/html'
+ OpenTox.text_to_html res
+ else
+ response['Content-Type'] = 'text/plain'
+ res
+ end
end
# Get task representation