Skip to content
This repository was archived by the owner on Jun 16, 2020. It is now read-only.

Commit 85f8991

Browse files
author
Antoine Detante
committed
Fix live site editing
1 parent cf890dd commit 85f8991

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

app/controllers/Application.scala

+9-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,15 @@ object Application extends Controller {
2323
Ok(views.html.editSiteDesc(website.SiteUtils.siteDescSource))
2424
}
2525

26-
def saveSiteDesc(source: String) = Action {
27-
website.SiteUtils.flushSiteDescSource(source)
26+
def saveSiteDesc = Action {request=>
27+
println(request.body)
28+
request.body.asFormUrlEncoded.map{
29+
_.get("source") match {
30+
case Some(source +: _) =>
31+
website.SiteUtils.flushSiteDescSource(source)
32+
case _ =>
33+
}
34+
}
2835
Redirect("/editSite")
2936
}
3037

app/website/SiteDesc.scala

+11
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ class SiteDesc extends Website {
2323
)
2424

2525
override val pages = List[Page](
26+
27+
listPage("bigAccounts")
28+
withQuery "SELECT CLI.NOM,CLI.PRENOM,CLI.ID FROM COMPTE CPT, CLIENT CLI WHERE CPT.SOLDE >= 10000 AND CLI.ID = CPT.CLIENT"
29+
withColumn
30+
"ID" -> "Détail" linkedTo "client" as "idClient" named "Détail du client",
31+
2632

2733
/* List of all clients, with a link to detail page of a client */
2834
listPage("clients")
@@ -101,3 +107,8 @@ class SiteDesc extends Website {
101107

102108

103109

110+
111+
112+
113+
114+

conf/routes

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ GET /assets/*file controllers.Assets.at(path="/public", file)
88

99
GET / controllers.Application.index
1010
GET /editSite controllers.Application.editSiteDesc
11-
GET /saveSite controllers.Application.saveSiteDesc(source:String)
11+
POST /saveSite controllers.Application.saveSiteDesc
1212

1313

1414
POST /login controllers.WebSQL.login

0 commit comments

Comments
 (0)