Skip to content

Commit 9d72d51

Browse files
committed
better formatting: show the msg parameter since it matters
1 parent c5462cc commit 9d72d51

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

samples/mini-forms/app/controllers/Comments.scala

+9-7
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@ object Comments extends Controller {
2222
"company" -> optional(text),
2323
"email" -> email,
2424
"phone" -> optional(text verifying jsPattern("""[0-9.+]+""", "constraint.phone", "A valid phone number is required")),
25-
"message" -> nonEmptyText.verifying(jsConstraint("constraint.nice_message", "error.nice_message") { new { def eval(c: JS) = { import c._; (msg: Rep[String]) => {
26-
val words = msg.split(" ")
27-
def countWords(regex: String) = words.filter(regex.r.test(_)).length
28-
val hateCount = countWords("[Hh]ate|[Ss]uck")
29-
val loveCount = countWords("[Ll]ove|[Rr]ock")
30-
hateCount < loveCount
31-
}}}})
25+
"message" -> nonEmptyText.verifying(jsConstraint("constraint.nice_message", "error.nice_message") { new { def eval(c: JS) = { import c._;
26+
(msg: Rep[String]) => {
27+
val words = msg.split(" ")
28+
def countWords(regex: String) = words.filter(regex.r.test(_)).length
29+
val hateCount = countWords("[Hh]ate|[Ss]uck")
30+
val loveCount = countWords("[Ll]ove|[Rr]ock")
31+
hateCount < loveCount
32+
}
33+
}}})
3234
)(Comment.apply)(Comment.unapply)
3335
)
3436

0 commit comments

Comments
 (0)