comparison app/controllers/Application.java @ 7:84e51aafdfed draft

Building the first screen
author e085711
date Thu, 13 Sep 2012 10:37:20 +0900
parents b216e48fc4a5
children 87c015a99196
comparison
equal deleted inserted replaced
6:db553ad77045 7:84e51aafdfed
7 7
8 import models.*; 8 import models.*;
9 9
10 public class Application extends Controller { 10 public class Application extends Controller {
11 11
12 @Before
13 static void addDefaults() {
14 renderArgs.put("blogTitle",Play.configuration.getProperty("blog.title"));
15 renderArgs.put("blogBaseline",Play.configuration.getProperty("blog.baseline"));
16 }
17
12 public static void index() { 18 public static void index() {
13 Post frontPost = Post.find("order by postedAt desc").first(); 19 Post frontPost = Post.find("order by postedAt desc").first();
14 List<Post> olderPosts = Post.find("order by postedAt desc").from(1).fetch(10); 20 List<Post> olderPosts = Post.find("order by postedAt desc").from(1).fetch(10);
15 render(frontPost,olderPosts); 21 render(frontPost,olderPosts);
16 } 22 }
35 41
36 render(list); 42 render(list);
37 43
38 } 44 }
39 45
46 public static void show(Long id) {
47 Post post = Post.findById(id);
48 render(post);
49 }
40 50
41 51
42 } 52 }