Permalink
Browse files

basic lists of trends and associated images

  • Loading branch information...
1 parent 88e4f51 commit a905313f984cb7e8140cbba95708dc82bce48061 @stevenwilkin committed Apr 29, 2009
Showing with 19 additions and 1 deletion.
  1. +5 −0 trends.rb
  2. +14 −1 views/index.haml
View
5 trends.rb
@@ -3,8 +3,13 @@
require 'rubygems'
require 'sinatra'
require 'haml'
+require 'json'
get '/' do
+ file = File.expand_path(File.dirname(__FILE__)) + '/var/trends.json'
+ json = JSON.parse(File.read(file))
+ @trends = json['trends']
+ @updated = json['as_of']
haml :index
end
View
15 views/index.haml
@@ -1 +1,14 @@
-images here
+#trends
+ current trends
+ %ol
+ - @trends.each do |t|
+ %li
+ %a{:href => t['url']}= t['name']
+ == last updated #{@updated}
+
+#images
+ %ol
+ - @trends.each do |t|
+ %li
+ %a{:href => t['url']}
+ %img{:src => t['img'], :alt => t['name'], :title => t['name']}

0 comments on commit a905313

Please sign in to comment.