Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

upgrade to play 2.1.0

  • Loading branch information...
commit 6b674e6b8998b0996869cf510dae71a199deec07 1 parent 6f48713
@jamesward authored
View
12 README
@@ -1,4 +1,10 @@
-This is your new Play 2.0 application
-=====================================
+Setup
+-----
+
+Create the local Postgres User and Datase:
+
+1. sudo -u postgres createuser -P hikeubertracks
+2. Enter `passsword` as the password for the `hikeubertracks` user
+3. Select `y` to enable the user to be a superuser
+4. createdb -U hikeubertracks -W -h localhost hikeubertracks
-This file will be packaged with your application, when using `play dist`.
View
8 app/controllers/ApplicationController.java
@@ -18,11 +18,11 @@ public static Result index() {
}
public static Result signupForm() {
- return ok(views.html.signupForm.render(form(User.class)));
+ return ok(views.html.signupForm.render(Form.form(User.class)));
}
public static Result signup() {
- Form<User> signupForm = form(User.class).bindFromRequest();
+ Form<User> signupForm = Form.form(User.class).bindFromRequest();
if (signupForm.hasErrors()) {
return badRequest(views.html.signupForm.render(signupForm));
}
@@ -44,12 +44,12 @@ public static Result signup() {
}
public static Result loginForm() {
- return ok(views.html.loginForm.render(form(Login.class)));
+ return ok(views.html.loginForm.render(Form.form(Login.class)));
}
public static Result login() {
- Form<Login> loginForm = form(Login.class).bindFromRequest();
+ Form<Login> loginForm = Form.form(Login.class).bindFromRequest();
if (loginForm.hasErrors()) {
return badRequest(views.html.loginForm.render(loginForm));
View
8 app/controllers/RegionController.java
@@ -108,7 +108,7 @@ public static Result unsubscribe(String urlFriendlyRegionName) {
@Security.Authenticated(Secured.class)
public static Result addRegion() {
- return ok(views.html.regionForm.render(form(Region.class)));
+ return ok(views.html.regionForm.render(Form.form(Region.class)));
}
@Security.Authenticated(Secured.class)
@@ -119,7 +119,7 @@ public static Result saveRegion() {
return unauthorized("You don't have access to do this.");
}
- Form<Region> regionForm = form(Region.class).bindFromRequest();
+ Form<Region> regionForm = Form.form(Region.class).bindFromRequest();
// check if the name is a duplicate
if ((regionForm.hasErrors() == false) && (Region.findByUrlFriendlyName(regionForm.get().getUrlFriendlyName()) != null)) {
@@ -172,7 +172,7 @@ public static Result deleteRegion(String urlFriendlyRegionName) {
@Security.Authenticated(Secured.class)
public static Result addRoute(String urlFriendlyRegionName) {
Region region = Region.findByUrlFriendlyName(urlFriendlyRegionName);
- return ok(views.html.routeForm.render(region, form(Route.class)));
+ return ok(views.html.routeForm.render(region, Form.form(Route.class)));
}
@Security.Authenticated(Secured.class)
@@ -200,7 +200,7 @@ public static Result saveRoute(String urlFriendlyRegionName) {
}
}
- Form<Route> routeForm = form(Route.class).bind(newData);
+ Form<Route> routeForm = Form.form(Route.class).bind(newData);
Region region = Region.findByUrlFriendlyName(urlFriendlyRegionName);
View
4 app/controllers/RouteController.java
@@ -44,14 +44,14 @@ public static Result saveComment(String urlFriendlyRegionName, String urlFriendl
return badRequest("User or Route not found");
}
- Form<Comment> commentForm = form(Comment.class).bindFromRequest();
+ Form<Comment> commentForm = Form.form(Comment.class).bindFromRequest();
if (commentForm.hasErrors()) {
flash("error", "Comment must not be empty.");
return redirect(routes.RouteController.getRouteHtml(urlFriendlyRegionName, urlFriendlyRouteName));
}
- Comment comment = form(Comment.class).bindFromRequest().get();
+ Comment comment = Form.form(Comment.class).bindFromRequest().get();
if (comment != null) {
comment.user = user;
comment.route = route;
View
3  app/jobs/DailyRegionDigestEmailJob.java
@@ -4,6 +4,7 @@
import com.typesafe.plugin.MailerPlugin;
import models.*;
import play.Logger;
+import play.api.DefaultApplication;
import play.api.Play;
import play.api.Mode;
import play.api.Application;
@@ -17,7 +18,7 @@
public static void main(String[] args) {
- Application application = new Application(new File(args[0]), DailyRegionDigestEmailJob.class.getClassLoader(), null, Mode.Prod());
+ Application application = new DefaultApplication(new File(args[0]), DailyRegionDigestEmailJob.class.getClassLoader(), null, Mode.Prod());
Play.start(application);
View
4 app/views/index.scala.html
@@ -20,8 +20,8 @@
<div class="row-fluid">
@for(i <- 0.to(regions.size - 1)) {
<div class="span4 well">
- <h3><a href="@routes.RegionController.getRegionHtml(regions.get(i).getUrlFriendlyName)">@regions.get(i).getName</a></h3>
- <a href="@routes.RegionController.getRegionHtml(regions.get(i).getUrlFriendlyName)"><img src="@regions.get(i).photo.getUrl"></a>
+ <h3><a href="@routes.RegionController.getRegionHtml(regions(i).getUrlFriendlyName)">@regions(i).getName</a></h3>
+ <a href="@routes.RegionController.getRegionHtml(regions(i).getUrlFriendlyName)"><img src="@regions(i).photo.getUrl"></a>
</div>
}
</div>
View
4 app/views/main.scala.html
@@ -5,8 +5,8 @@
<head>
<title>@title</title>
<link rel="shortcut icon" type="image/png" href="@routes.Assets.at("images/favicon.png")">
- <link rel="stylesheet" type="text/css" href="@routes.Assets.at("com.github.twitter/bootstrap/css/bootstrap.min.css")">
- <script type="text/javascript" src="@routes.Assets.at("javascripts/jquery.min.js")"></script>
+ <link rel='stylesheet' href='@routes.WebJarAssets.at(WebJarAssets.locate("css/bootstrap.min.css"))'>
+ <script type='text/javascript' src='@routes.WebJarAssets.at(WebJarAssets.locate("jquery.min.js"))'></script>
<style type="text/css">
body {
margin-top: 50px;
View
2  app/views/region.scala.html
@@ -1,5 +1,7 @@
@(region: Region, sort: String)
+@import scala.collection.JavaConversions._
+
@headContent = {
<link rel="alternate" type="application/rss+xml" title="@region.getName RSS Feed" href="@routes.RegionController.getRegionFeed(region.getUrlFriendlyName)" />
}
View
2  app/views/route.scala.html
@@ -1,5 +1,7 @@
@(route: Route)
+@import scala.collection.JavaConversions._
+
@headContent = {
}
View
1  conf/routes
@@ -40,3 +40,4 @@ GET /:region controllers.RegionController.getRegionHtml(r
# Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(path="/public", file)
+GET /webjars/*file controllers.WebJarAssets.at(file)
View
32 project/Build.scala
@@ -1,23 +1,27 @@
import sbt._
import Keys._
-import PlayProject._
+import play.Project
+import play.Project._
object ApplicationBuild extends Build {
- val appName = "happytrails"
- val appVersion = "1.0-SNAPSHOT"
+ val appName = "happytrails"
+ val appVersion = "1.0-SNAPSHOT"
- val appDependencies = Seq(
- "com.github.twitter" % "bootstrap" % "2.0.4",
- "postgresql" % "postgresql" % "9.1-901-1.jdbc4",
- "rome" % "rome" % "1.0",
- "com.typesafe" %% "play-plugins-mailer" % "2.0.2",
- "com.amazonaws" % "aws-java-sdk" % "1.3.11",
- "org.imgscalr" % "imgscalr-lib" % "4.2"
- )
+ val appDependencies = Seq(
+ javaCore,
+ javaJdbc,
+ javaEbean,
+ "org.webjars" % "webjars-play" % "2.1.0",
+ "org.webjars" % "bootstrap" % "2.3.1",
+ "postgresql" % "postgresql" % "9.1-901-1.jdbc4",
+ "rome" % "rome" % "1.0",
+ "com.typesafe" %% "play-plugins-mailer" % "2.1.0",
+ "com.amazonaws" % "aws-java-sdk" % "1.3.11",
+ "org.imgscalr" % "imgscalr-lib" % "4.2"
+ )
- val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings(
- resolvers += "webjars" at "http://webjars.github.com/m2"
- )
+ val main = Project(appName, appVersion, appDependencies).settings(
+ )
}
View
2  project/build.properties
@@ -1 +1 @@
-sbt.version=0.11.3
+sbt.version=0.12.2
View
2  project/plugins.sbt
@@ -5,4 +5,4 @@ logLevel := Level.Warn
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
// Use the Play sbt plugin for Play projects
-addSbtPlugin("play" % "sbt-plugin" % "2.0.3")
+addSbtPlugin("play" % "sbt-plugin" % "2.1.0")
Please sign in to comment.
Something went wrong with that request. Please try again.