]> www.vanbest.org Git - lootjes-play/commitdiff
Added simple admin pages
authorJP <jp@here>
Tue, 14 Feb 2012 13:53:38 +0000 (14:53 +0100)
committerJP <jp@here>
Tue, 14 Feb 2012 13:53:38 +0000 (14:53 +0100)
app/controllers/Partys.java [new file with mode: 0644]
app/controllers/Users.java [new file with mode: 0644]
app/models/Party.java
app/models/User.java
conf/application.conf
conf/dependencies.yml
conf/routes

diff --git a/app/controllers/Partys.java b/app/controllers/Partys.java
new file mode 100644 (file)
index 0000000..a47fa84
--- /dev/null
@@ -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 (file)
index 0000000..29f4dd3
--- /dev/null
@@ -0,0 +1,7 @@
+package controllers;
+import play.*;
+import play.mvc.*;
+public class Users extends CRUD {    
+}
index 84a5c8063bf1eca105686727b7bb50a318399680..50c002ed055865d6ed9c6793c8294ab88624dbf7 100644 (file)
@@ -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) + ")";
+    }
 }
index 5147f98423dda51782403a7efe7e84508f5f900c..8b9ff8e5893672d71bd6cc5b8042c3c7d9c841d9 100644 (file)
@@ -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 + ")";
+    }
+
 }
index 56bc829263e25292202a29ce7988de6411cf5a10..5629d1c3b62147048a5a1dd13c97c575930f9385 100644 (file)
@@ -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
index 85373765a10666fb5e0a9d4258dd12434841bf90..18489a790b8b1c67c886ba82d90f55d3b8be65ef 100644 (file)
@@ -1,4 +1,5 @@
 # Application dependencies
 
 require:
+    - play -> crud
     - play
index 5ec7a3ecef589fe9dc1539a2b5c8100017462193..24c4663e409bdcc23705159e3ac6d0ca069ed1bc 100644 (file)
@@ -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