File tree Expand file tree Collapse file tree 8 files changed +58
-44
lines changed Expand file tree Collapse file tree 8 files changed +58
-44
lines changed Original file line number Diff line number Diff line change 8
8
public class Application extends Controller {
9
9
10
10
public static Result index () {
11
- return ok ( index . render ( "Your new application is ready." ));
11
+ return redirect ( routes . Products . list ( ));
12
12
}
13
13
14
14
}
Original file line number Diff line number Diff line change 1
1
@(message: String)
2
2
3
- @main("Welcome to Play 2.1 ") {
3
+ @main("Welcome to Play 2.2 ") {
4
4
5
5
@play20.welcome(message, style = "Java")
6
6
Original file line number Diff line number Diff line change 1
1
@(products: Set[Product])
2
-
3
- @import helper._
4
2
@main("Products catalogue") {
5
3
6
- < h1 > All products</ h1 >
4
+ < h2 > All products</ h2 >
5
+
6
+ < script >
7
+ function del ( urlToDelete ) {
8
+ $ . ajax ( {
9
+ url : urlToDelete ,
10
+ type : 'DELETE' ,
11
+ success : function ( results ) {
12
+ // Refresh the page
13
+ location . reload ( ) ;
14
+ }
15
+ } ) ;
16
+ }
17
+ </ script >
7
18
8
- < dl >
9
- @for(product < - products) {
10
- < dt >
19
+ < table class ="table table-striped ">
20
+ < thead >
21
+ < tr >
22
+ < th > EAN</ th >
23
+ < th > Name</ th >
24
+ < th > Description</ th >
25
+ < th > </ th >
26
+ </ tr >
27
+ </ thead >
28
+ < tbody >
29
+ @for(product < - products) {
11
30
12
- < a href ="@routes.Products.details(product.ean) ">
13
- < i class ="icon icon-pencil "> </ i >
14
- @product.ean - @product.name
15
- </ a >
16
- </ dt >
17
- < dd > @product.description
18
- @form(action = routes.Products.delete(product.ean)){
19
- < button type ="submit " class ="btn btn-danger btn-mini ">
20
- < i class ="icon icon-white icon-trash "> </ i > Delete</ button >
31
+ < tr >
32
+ < td > < a href ="@routes.Products.details(product.ean) ">
33
+ @product.ean
34
+ </ a > </ td >
35
+ < td > < a href ="@routes.Products.details(product.ean) "> @product.name</ a > </ td >
36
+ < td > < a href ="@routes.Products.details(product.ean) "> @product.name</ a > </ td >
37
+ < td >
38
+ < a href ="@routes.Products.details(product.ean) "> < i class ="icon icon-pencil "> </ i > </ a >
39
+ < a onclick ="javascript:del('@routes.Products.details(product.ean)') "> < i class ="icon icon-trash "> </ i > </ a >
40
+ </ td >
41
+ </ tr >
21
42
}
22
- </ dd >
23
- }
24
- </ dl >
43
+
44
+ </ tbody >
45
+ </ table >
25
46
47
+
48
+
26
49
< a href ="@routes.Products.newProduct() " class ="btn ">
27
50
< i class ="icon-plus "> </ i > New product</ a >
28
51
}
Original file line number Diff line number Diff line change
1
+ name := " warehouse"
2
+
3
+ version := " 1.0-SNAPSHOT"
4
+
5
+ libraryDependencies ++= Seq (
6
+ javaJdbc,
7
+ javaEbean,
8
+ cache,
9
+ " com.google.guava" % " guava" % " 14.0"
10
+ )
11
+
12
+ play.Project .playJavaSettings
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ GET /products/ controllers.Products.list()
9
9
GET /products/new controllers.Products.newProduct()
10
10
GET /products/:ean controllers.Products.details(ean: String)
11
11
POST /products/ controllers.Products.save()
12
- POST /products/:ean/delete controllers.Products.delete(ean: String)
12
+ DELETE /products/:ean controllers.Products.delete(ean: String)
13
13
14
14
# Map static resources from the /public folder to the /assets URL path
15
15
GET /assets/*file controllers.Assets.at(path="/public", file)
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- sbt.version =0.12.2
1
+ sbt.version =0.13.0
Original file line number Diff line number Diff line change @@ -5,4 +5,4 @@ logLevel := Level.Warn
5
5
resolvers += " Typesafe repository" at " http://repo.typesafe.com/typesafe/releases/"
6
6
7
7
// Use the Play sbt plugin for Play projects
8
- addSbtPlugin(" play" % " sbt-plugin" % " 2.1.1 " )
8
+ addSbtPlugin(" com.typesafe. play" % " sbt-plugin" % " 2.2.0 " )
You can’t perform that action at this time.
0 commit comments