diff options
author | mguetlein <martin.guetlein@gmail.com> | 2011-06-29 11:36:45 +0200 |
---|---|---|
committer | mguetlein <martin.guetlein@gmail.com> | 2011-06-29 11:36:45 +0200 |
commit | 3bc3b9b907acbb396463188e34cb04e99da1fb57 (patch) | |
tree | 0fcaacac04338cf2262abf6fe64bf9bbbeae997a /application.rb | |
parent | dcb32e4271cb1cab70f3669985e8e34c87e3bf23 (diff) |
add html support for dataset listing
Diffstat (limited to 'application.rb')
-rw-r--r-- | application.rb | 11 |
1 files 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 |