File tree 1 file changed +9
-7
lines changed
samples/mini-forms/app/controllers
1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -22,13 +22,15 @@ object Comments extends Controller {
22
22
" company" -> optional(text),
23
23
" email" -> email,
24
24
" 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
+ }}})
32
34
)(Comment .apply)(Comment .unapply)
33
35
)
34
36
You can’t perform that action at this time.
0 commit comments