From 3bc3b9b907acbb396463188e34cb04e99da1fb57 Mon Sep 17 00:00:00 2001 From: mguetlein Date: Wed, 29 Jun 2011 11:36:45 +0200 Subject: add html support for dataset listing --- application.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/application.rb b/application.rb index 749dbcc..a77d5d3 100644 --- a/application.rb +++ b/application.rb @@ -123,8 +123,15 @@ end # Get a list of available datasets # @return [text/uri-list] List of available datasets get '/?' do - response['Content-Type'] = 'text/uri-list' - Dir["./public/*yaml"].collect{|f| File.basename(f.sub(/.yaml/,'')).to_i}.sort.collect{|n| uri n}.join("\n") + "\n" + uri_list = Dir["./public/*yaml"].collect{|f| File.basename(f.sub(/.yaml/,'')).to_i}.sort.collect{|n| uri n}.join("\n") + "\n" + case @accept + when /html/ + response['Content-Type'] = 'text/html' + OpenTox.text_to_html uri_list + else + response['Content-Type'] = 'text/uri-list' + uri_list + end end # Get a dataset representation -- cgit v1.2.3