From: JP Date: Tue, 14 Feb 2012 13:53:38 +0000 (+0100) Subject: Added simple admin pages X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=7516673d5a43f90a4935000a6c2d8817e7cb7061;p=lootjes-play Added simple admin pages --- diff --git a/app/controllers/Partys.java b/app/controllers/Partys.java new file mode 100644 index 0000000..a47fa84 --- /dev/null +++ b/app/controllers/Partys.java @@ -0,0 +1,7 @@ +package controllers; + +import play.*; +import play.mvc.*; + +public class Partys extends CRUD { +} diff --git a/app/controllers/Users.java b/app/controllers/Users.java new file mode 100644 index 0000000..29f4dd3 --- /dev/null +++ b/app/controllers/Users.java @@ -0,0 +1,7 @@ +package controllers; + +import play.*; +import play.mvc.*; + +public class Users extends CRUD { +} diff --git a/app/models/Party.java b/app/models/Party.java index 84a5c80..50c002e 100644 --- a/app/models/Party.java +++ b/app/models/Party.java @@ -1,15 +1,20 @@ package models; import java.util.*; +import java.text.DateFormat; import javax.persistence.*; import play.db.jpa.*; +import play.data.validation.*; @Entity public class Party extends Model { + @Required public String description; + @Required public Date date; + @Required @ManyToOne(cascade=CascadeType.ALL) public User organiser; @ManyToMany @@ -30,4 +35,8 @@ public class Party extends Model { this.save(); return this; } + + public String toString() { + return description + " (" + DateFormat.getDateInstance(DateFormat.SHORT).format(date) + ")"; + } } diff --git a/app/models/User.java b/app/models/User.java index 5147f98..8b9ff8e 100644 --- a/app/models/User.java +++ b/app/models/User.java @@ -5,11 +5,15 @@ import javax.persistence.*; import javax.xml.bind.annotation.adapters.HexBinaryAdapter; import play.db.jpa.*; +import play.data.validation.*; @Entity public class User extends Model { - + + @Email + @Required public String email; + @Required public String password; public String fullname; public String hash; @@ -40,4 +44,8 @@ public class User extends Model { return find("byEmailAndPassword", email, password).first(); } + public String toString() { + return fullname + " (" + email + ")"; + } + } diff --git a/conf/application.conf b/conf/application.conf index 56bc829..5629d1c 100644 --- a/conf/application.conf +++ b/conf/application.conf @@ -221,4 +221,4 @@ blog.title=Yet another blog blog.baseline=We will write about nothing # Import the secure module -module.secure=${play.path}/modules/secure +% module.secure=${play.path}/modules/secure diff --git a/conf/dependencies.yml b/conf/dependencies.yml index 8537376..18489a7 100644 --- a/conf/dependencies.yml +++ b/conf/dependencies.yml @@ -1,4 +1,5 @@ # Application dependencies require: + - play -> crud - play diff --git a/conf/routes b/conf/routes index 5ec7a3e..24c4663 100644 --- a/conf/routes +++ b/conf/routes @@ -8,8 +8,11 @@ GET / Application.index # Party page GET /party/{id} Application.showParty +# Import CRUD routes +* /admin/ module:crud + # Import Secure routes -* / module:secure +# geen gezicht * / module:secure # Ignore favicon requests GET /favicon.ico 404