Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Brandt authored and Andrew Brandt committed Jun 11, 2012
0 parents commit 097669e
Show file tree
Hide file tree
Showing 18 changed files with 377 additions and 0 deletions.
92 changes: 92 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<classpath>
<classpathentry output="target/scala-2.9.1/classes" path="app" kind="src"></classpathentry>
<classpathentry output="target/scala-2.9.1/test-classes" path="test" kind="src"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/sbt/boot/scala-2.9.1/lib/scala-library.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/play/play_2.9.1/2.0.1/jars/play_2.9.1.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/play/templates_2.9.1/2.0.1/jars/templates_2.9.1.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/./repository/local/com.github.scala-incubator.io/scala-io-file_2.9.1/0.2.0/jars/scala-io-file_2.9.1.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/./repository/local/com.github.scala-incubator.io/scala-io-core_2.9.1/0.2.0/jars/scala-io-core_2.9.1.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/./repository/local/com.github.jsuereth.scala-arm/scala-arm_2.9.1/0.3/jars/scala-arm_2.9.1.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/play/anorm_2.9.1/2.0.1/jars/anorm_2.9.1.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/io.netty/netty/3.3.0.Final/bundles/netty.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.slf4j/slf4j-api/1.6.4/jars/slf4j-api.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.slf4j/jul-to-slf4j/1.6.4/jars/jul-to-slf4j.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.slf4j/jcl-over-slf4j/1.6.4/jars/jcl-over-slf4j.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/ch.qos.logback/logback-core/1.0.0/jars/logback-core.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/ch.qos.logback/logback-classic/1.0.0/jars/logback-classic.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/com.typesafe.akka/akka-actor/2.0.1/jars/akka-actor.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/com.typesafe.akka/akka-slf4j/2.0.1/jars/akka-slf4j.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/com.google.guava/guava/10.0.1/jars/guava.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/com.google.code.findbugs/jsr305/1.3.9/jars/jsr305.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.avaje/ebean/2.7.3/jars/ebean.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.hibernate.javax.persistence/hibernate-jpa-2.0-api/1.0.1.Final/jars/hibernate-jpa-2.0-api.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/com.h2database/h2/1.3.158/jars/h2.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.scala-tools/scala-stm_2.9.1/0.4/jars/scala-stm_2.9.1.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/com.jolbox/bonecp/0.7.1.RELEASE/bundles/bonecp.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.yaml/snakeyaml/1.9/bundles/snakeyaml.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.hibernate/hibernate-validator/4.2.0.Final/jars/hibernate-validator.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/javax.validation/validation-api/1.0.0.GA/jars/validation-api.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.springframework/spring-context/3.0.7.RELEASE/jars/spring-context.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.springframework/spring-core/3.0.7.RELEASE/jars/spring-core.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.springframework/spring-beans/3.0.7.RELEASE/jars/spring-beans.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/joda-time/joda-time/2.0/jars/joda-time.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.joda/joda-convert/1.1/jars/joda-convert.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/javassist/javassist/3.12.1.GA/jars/javassist.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/commons-lang/commons-lang/2.6/jars/commons-lang.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/com.ning/async-http-client/1.7.0/jars/async-http-client.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/oauth.signpost/signpost-core/1.2.1.1/jars/signpost-core.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/commons-codec/commons-codec/1.3/jars/commons-codec.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/com.codahale/jerkson_2.9.1/0.5.0/jars/jerkson_2.9.1.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.codehaus.jackson/jackson-core-asl/1.9.6/jars/jackson-core-asl.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.codehaus.jackson/jackson-mapper-asl/1.9.6/jars/jackson-mapper-asl.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.reflections/reflections/0.9.6/jars/reflections.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/javax.servlet/javax.servlet-api/3.0.1/jars/javax.servlet-api.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/javax.transaction/jta/1.1/jars/jta.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/tyrex/tyrex/1.0.1/jars/tyrex.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/jaxen/jaxen/1.1.3/jars/jaxen.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/net.sf.ehcache/ehcache-core/2.5.0/jars/ehcache-core.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/play/play-test_2.9.1/2.0.1/jars/play-test_2.9.1.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.specs2/specs2_2.9.1/1.7.1/jars/specs2_2.9.1.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.specs2/specs2-scalaz-core_2.9.1/6.0.1/jars/specs2-scalaz-core_2.9.1.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/com.novocode/junit-interface/0.8/jars/junit-interface.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/junit/junit/4.8.2/jars/junit.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.scala-tools.testing/test-interface/0.5/jars/test-interface.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.fluentlenium/fluentlenium-festassert/0.5.6/jars/fluentlenium-festassert.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.fluentlenium/fluentlenium-core/0.5.6/jars/fluentlenium-core.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.seleniumhq.selenium/selenium-java/2.16.1/jars/selenium-java.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.seleniumhq.selenium/selenium-android-driver/2.16.1/jars/selenium-android-driver.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.seleniumhq.selenium/selenium-remote-driver/2.16.1/jars/selenium-remote-driver.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/cglib/cglib-nodep/2.1_3/jars/cglib-nodep.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.json/json/20080701/jars/json.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.seleniumhq.selenium/selenium-api/2.16.1/jars/selenium-api.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.apache.httpcomponents/httpclient/4.1.2/jars/httpclient.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.apache.httpcomponents/httpcore/4.1.3/jars/httpcore.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/commons-logging/commons-logging/1.1.1/jars/commons-logging.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/commons-codec/commons-codec/1.4/jars/commons-codec.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.apache.commons/commons-exec/1.1/jars/commons-exec.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/net.java.dev.jna/jna/3.4.0/jars/jna.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/net.java.dev.jna/platform/3.4.0/jars/platform.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.seleniumhq.selenium/selenium-chrome-driver/2.16.1/jars/selenium-chrome-driver.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.seleniumhq.selenium/selenium-htmlunit-driver/2.16.1/jars/selenium-htmlunit-driver.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/net.sourceforge.htmlunit/htmlunit/2.9/jars/htmlunit.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/xalan/xalan/2.7.1/jars/xalan.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/xalan/serializer/2.7.1/jars/serializer.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/xml-apis/xml-apis/1.3.04/jars/xml-apis.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/commons-collections/commons-collections/3.2.1/jars/commons-collections.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.apache.httpcomponents/httpmime/4.1.2/jars/httpmime.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/net.sourceforge.htmlunit/htmlunit-core-js/2.9/jars/htmlunit-core-js.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/xerces/xercesImpl/2.9.1/jars/xercesImpl.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/net.sourceforge.nekohtml/nekohtml/1.9.15/jars/nekohtml.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/net.sourceforge.cssparser/cssparser/0.9.5/jars/cssparser.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.w3c.css/sac/1.3/jars/sac.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/commons-io/commons-io/2.0.1/jars/commons-io.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.seleniumhq.selenium/selenium-firefox-driver/2.16.1/jars/selenium-firefox-driver.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.seleniumhq.selenium/selenium-ie-driver/2.16.1/jars/selenium-ie-driver.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.seleniumhq.selenium/selenium-iphone-driver/2.16.1/jars/selenium-iphone-driver.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.seleniumhq.selenium/selenium-support/2.16.1/jars/selenium-support.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.easytesting/fest-assert/1.4/jars/fest-assert.jar" kind="lib"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/framework/../repository/local/org.easytesting/fest-util/1.1.6/jars/fest-util.jar" kind="lib"></classpathentry>
<classpathentry path="org.eclipse.jdt.launching.JRE_CONTAINER" kind="con"></classpathentry>
<classpathentry path="bin" kind="output"></classpathentry>
<classpathentry path="/Applications/play-2.0.1/todolist/target/scala-2.9.1/classes_managed" kind="lib"></classpathentry>
</classpath>
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
logs
project/project
project/target
target
tmp
.history
dist
12 changes: 12 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<projectDescription>
<name>todolist</name>
<buildSpec>
<buildCommand>
<name>org.scala-ide.sdt.core.scalabuilder</name>
</buildCommand>
</buildSpec>
<natures>
<nature>org.scala-ide.sdt.core.scalanature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
7 changes: 7 additions & 0 deletions .settings/org.scala-ide.sdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#Generated by sbteclipse
#Sun Jun 10 22:34:53 EDT 2012
Xcheckinit=true
deprecation=true
encoding=utf8
unchecked=true
scala.compiler.useProjectSettings=true
4 changes: 4 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This is your new Play 2.0 application
=====================================

This file will be packaged with your application, when using `play dist`.
41 changes: 41 additions & 0 deletions app/controllers/Application.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package controllers;

import models.Task;
import play.*;
import play.mvc.*;
import play.data.*;

import views.html.*;

public class Application extends Controller {

static Form<Task> taskForm = form(Task.class);

public static Result index() {
return redirect(routes.Application.tasks());
}

public static Result tasks() {
return ok(
views.html.index.render(Task.all(), taskForm));
}

public static Result newTask() {
Form<Task> filledForm = taskForm.bindFromRequest();
if(filledForm.hasErrors()) {
return badRequest(
views.html.index.render(Task.all(), filledForm));
}
else {
Task.create(filledForm.get());
return redirect(routes.Application.tasks());
}
}

public static Result deleteTask(Long id) {
Task.delete(id);
return redirect(routes.Application.tasks());
}


}
39 changes: 39 additions & 0 deletions app/models/Task.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package models;

import java.util.*;

import play.data.validation.Constraints.*;
import play.db.ebean.*;

import javax.persistence.*;

@Entity
public class Task extends Model{

@Required
public String label;

@Id
public long id;

public static Finder<Long,Task> find = new Finder(
Long.class, Task.class);


public static List<Task> all() {
if (find.all() == null)
{
return new ArrayList<Task>();
}
return find.all();
}

public static void create(Task task) {
task.save();
}

public static void delete(long id) {
find.ref(id).delete();
}

}
31 changes: 31 additions & 0 deletions app/views/index.scala.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@(tasks: List[Task], taskForm: Form[Task])

@import helper._

@main("Todo list") {

<h1>@tasks.size() task(s)</h1>

<ul>
@for(task <- tasks) {
<li>
@task.label

@form(routes.Application.deleteTask(task.id)) {
<input type="submit" value="Delete">
}
</li>
}
</ul>

<h2>Add a new task</h2>

@form(routes.Application.newTask()) {

@inputText(taskForm("label"))

<input type="submit" value="Create">

}

}
15 changes: 15 additions & 0 deletions app/views/main.scala.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@(title: String)(content: Html)

<!DOCTYPE html>

<html>
<head>
<title>@title</title>
<link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/main.css")">
<link rel="shortcut icon" type="image/png" href="@routes.Assets.at("images/favicon.png")">
<script src="@routes.Assets.at("javascripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
</head>
<body>
@content
</body>
</html>
58 changes: 58 additions & 0 deletions conf/application.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This is the main configuration file for the application.
# ~~~~~

# Secret key
# ~~~~~
# The secret key is used to secure cryptographics functions.
# If you deploy your application to several instances be sure to use the same key!
application.secret="ZmFsw0j<ObQ0fL:dgis:A?t35f2w0OpTtP@e6ptpjK93Zukdf4xZ@:K1;GqXUUHV"

# The application languages
# ~~~~~
application.langs="en"

# Global object class
# ~~~~~
# Define the Global object class for this application.
# Default to Global in the root package.
# global=Global

# Database configuration
# ~~~~~
# You can declare as many datasources as you want.
# By convention, the default datasource is named `default`
#
db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:mem:play"
# db.default.user=sa
# db.default.password=
ebean.default="models.*"
#
# You can expose this datasource via JNDI if needed (Useful for JPA)
# db.default.jndiName=DefaultDS

# Evolutions
# ~~~~~
# You can disable evolutions if needed
# evolutionplugin=disabled

# Ebean configuration
# ~~~~~
# You can declare as many Ebean servers as you want.
# By convention, the default server is named `default`
#
# ebean.default="models.*"

# Logger
# ~~~~~
# You can also configure logback (http://logback.qos.ch/), by providing a logger.xml file in the conf directory .

# Root logger:
logger.root=ERROR

# Logger used by the framework:
logger.play=INFO

# Logger provided to your application:
logger.application=DEBUG

26 changes: 26 additions & 0 deletions conf/evolutions/default/1.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# --- Created by Ebean DDL
# To stop Ebean DDL generation, remove this comment and start using Evolutions

# --- !Ups

create table task (
id bigint not null,
label varchar(255),
constraint pk_task primary key (id))
;

create sequence task_seq;




# --- !Downs

SET REFERENTIAL_INTEGRITY FALSE;

drop table if exists task;

SET REFERENTIAL_INTEGRITY TRUE;

drop sequence if exists task_seq;

Loading

0 comments on commit 097669e

Please sign in to comment.