Commits

Koen Van der Auwera  committed b3e3337

show last and random on index

  • Participants
  • Parent commits 1229de5

Comments (0)

Files changed (2)

 module Amanda::Controllers
   class Index < R '/'
     def get
+      @last = STORE.last
+      @random = STORE.random
       render :index
     end
   end
   end
 
   def index
-    STORE.keys "*"
+    div.post! do
+      h2 @last.title
+      div.content! { RDiscount.new(@last.content, :smart).to_html }
+      div.meta! @last.id
+    end
+    div.post! do
+      h2 @random.title
+      div.content! { RDiscount.new(@random.content, :smart).to_html }
+      div.meta! @random.id
+    end
   end
 
   def single

File amanda/store.rb

     end
 
     def random
-      post(redis.srandmember(POSTS_RANDOM, 1))
+      post(redis.srandmember(POSTS_RANDOM))
     end
 
     def last
-      post(redis.get("posts:last"))
+      post(redis.get(POSTS_LAST_KEY))
     end
 
     def changed?(post_id, rev)