Skip to content

Commit

Permalink
[#9] Allow class attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
xael-fry committed May 8, 2012
1 parent 0b878bb commit a66bc9e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
8 changes: 7 additions & 1 deletion app/tags/jqvalidate/JqValidateTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,19 @@ public static void _form(Map<?, ?> args, Closure body, PrintWriter out, Executab
if (args.containsKey("method")) {
actionDef.method = args.get("method").toString();
}

String classes = "play-jqvalid-form";
if (args.containsKey("class")) {
classes += " " + args.get("class").toString();
}

if (!("GET".equals(actionDef.method) || "POST".equals(actionDef.method))) {
String separator = actionDef.url.indexOf('?') != -1 ? "&" : "?";
actionDef.url += separator + "x-http-method-override=" + actionDef.method.toUpperCase();
actionDef.method = "POST";
}
String id = args.containsKey("id") ? (String)args.get("id") : "play-jqvalid-form__"+UUID.randomUUID();
out.println("<form class=\"play-jqvalid-form\" id=\""+ id +"\" action=\"" + actionDef.url + "\" method=\"" + actionDef.method.toUpperCase() + "\" accept-charset=\"utf-8\" enctype=\"" + enctype + "\" " + serialize(args, "action", "method", "accept-charset", "enctype") + ">");
out.println("<form class=\"" + classes + "\" id=\""+ id +"\" action=\"" + actionDef.url + "\" method=\"" + actionDef.method.toUpperCase() + "\" accept-charset=\"utf-8\" enctype=\"" + enctype + "\" " + serialize(args, "action", "method", "accept-charset", "enctype") + ">");
if (!("GET".equals(actionDef.method))) {
_authenticityToken(args, body, out, template, fromLine);
}
Expand Down
2 changes: 1 addition & 1 deletion samples-and-tests/jqvalidate-example/conf/application.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This is the main configuration file for the application.
# ~~~~~
application.name=Form Validation Demo
application.name=JQValidate Example

# Application mode
# ~~~~~
Expand Down
5 changes: 2 additions & 3 deletions samples-and-tests/jqvalidate-example/conf/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

require:
- play
- play -> gae 1.1
- play -> gae 1.6.0
- play -> siena 2.0.7
- play -> jqvalidate 1.0

- play -> jqvalidate head

0 comments on commit a66bc9e

Please sign in to comment.