Mercurial > hg > Members > nobuyasu > tasks
changeset 11:c8e930683c14 draft
add Sample action
author | one |
---|---|
date | Sat, 15 Sep 2012 15:34:33 +0900 |
parents | 2cd590fc87bf |
children | b07fa52392e2 |
files | app/controllers/Sample.java app/views/Sample/index.html conf/application.conf conf/dependencies.yml eclipse/Connect JPDA to Tasks.launch tmp/bytecode/DEV/_app_views_main.html |
diffstat | 6 files changed, 49 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/controllers/Sample.java Sat Sep 15 15:34:33 2012 +0900 @@ -0,0 +1,19 @@ +package controllers; + +import java.util.List; + +import models.Post; +import play.mvc.Controller; + +public class Sample extends Controller { + + public static void index() { + Post frontPost = Post.find("order by postedAt desc").first(); + List<Post> olderPosts = Post.find("order by postedAt desc").from(1).fetch(10); +// render(frontPost,olderPosts); + String str = "{ \"data\" : \"5\"}"; + renderJSON(str); + } + + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/views/Sample/index.html Sat Sep 15 15:34:33 2012 +0900 @@ -0,0 +1,26 @@ +#{extends 'main.html' /} +#{set title:'Home' /} + +#{if frontPost} + + #{display post:frontPost, as:'home' /} + + #{if olderPosts.size()} + + <div class="older-posts"> + <h3>Older posts <span class="from">from this blog</span></h3> + + #{list items:olderPosts, as:'oldPost'} + #{display post:oldPost, as:'teaser' /} + #{/list} + </div> + + #{/if} + +#{/if} + +#{else} + <div class="empty"> + There is currently nothing to read here. + </div> +#{/else} \ No newline at end of file
--- a/conf/application.conf Thu Sep 13 11:18:22 2012 +0900 +++ b/conf/application.conf Sat Sep 15 15:34:33 2012 +0900 @@ -212,7 +212,5 @@ %test.jpa.ddl=create %test.mail.smtp=mock -module.crud=${play.path}/modules/crud - blog.title=Yet another blog blog.baseline=We will write about nothing \ No newline at end of file
--- a/conf/dependencies.yml Thu Sep 13 11:18:22 2012 +0900 +++ b/conf/dependencies.yml Sat Sep 15 15:34:33 2012 +0900 @@ -1,4 +1,4 @@ # Application dependencies require: - - play + - play -> crud
--- a/eclipse/Connect JPDA to Tasks.launch Thu Sep 13 11:18:22 2012 +0900 +++ b/eclipse/Connect JPDA to Tasks.launch Sat Sep 15 15:34:33 2012 +0900 @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="UTF-8"?> +<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration type="org.eclipse.jdt.launching.remoteJavaApplication"> <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> <listEntry value="/Tasks"/> @@ -8,9 +8,9 @@ </listAttribute> <booleanAttribute key="org.eclipse.jdt.launching.ALLOW_TERMINATE" value="false"/> <mapAttribute key="org.eclipse.jdt.launching.CONNECT_MAP"> +<mapEntry key="hostname" value="localhost"/> <mapEntry key="port" value="8000"/> -<mapEntry key="hostname" value="localhost"/> </mapAttribute> <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Tasks"/> <stringAttribute key="org.eclipse.jdt.launching.VM_CONNECTOR_ID" value="org.eclipse.jdt.launching.socketAttachConnector"/> -</launchConfiguration> \ No newline at end of file +</launchConfiguration>