You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2013/09/04 02:07:13 UTC
[2/2] git commit: Add class="form-control" to the KaptchaField
Add class="form-control" to the KaptchaField
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/a586a1af
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/a586a1af
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/a586a1af
Branch: refs/heads/master
Commit: a586a1af6df28fcf9e2a8567797039c187c332ea
Parents: 9df0250
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Tue Sep 3 17:07:07 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Tue Sep 3 17:07:07 2013 -0700
----------------------------------------------------------------------
.../kaptcha/components/KaptchaField.java | 7 ++-
.../java/kaptcha/demo/components/Layout.java | 5 +-
.../kaptcha/demo/components/Layout.tml | 24 ++++------
.../test/resources/kaptcha/demo/pages/Index.tml | 12 ++---
.../kaptcha/demo/pages/KaptchaDemo.tml | 50 +++++++++-----------
5 files changed, 44 insertions(+), 54 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a586a1af/tapestry-kaptcha/src/main/java/org/apache/tapestry5/kaptcha/components/KaptchaField.java
----------------------------------------------------------------------
diff --git a/tapestry-kaptcha/src/main/java/org/apache/tapestry5/kaptcha/components/KaptchaField.java b/tapestry-kaptcha/src/main/java/org/apache/tapestry5/kaptcha/components/KaptchaField.java
index a559aba..880aaf8 100644
--- a/tapestry-kaptcha/src/main/java/org/apache/tapestry5/kaptcha/components/KaptchaField.java
+++ b/tapestry-kaptcha/src/main/java/org/apache/tapestry5/kaptcha/components/KaptchaField.java
@@ -1,4 +1,4 @@
-// Copyright 2011, 2012 The Apache Software Foundation
+// Copyright 2011-2013 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -29,7 +29,8 @@ import org.apache.tapestry5.services.FieldValidatorSource;
/**
* Field paired with a {@link KaptchaImage} to ensure that the user has provided
- * the correct value.
+ * the correct value. Renders a class attribute of "form-control", which can be extended
+ * via the class informal attribute.
*
* @since 5.3
* @tapestrydoc
@@ -93,6 +94,8 @@ public class KaptchaField extends AbstractField
"id", getClientId(),
+ "class", "form-control",
+
"name", getControlName(),
"value", visible ? validationTracker.getInput(this) : "");
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a586a1af/tapestry-kaptcha/src/test/java/kaptcha/demo/components/Layout.java
----------------------------------------------------------------------
diff --git a/tapestry-kaptcha/src/test/java/kaptcha/demo/components/Layout.java b/tapestry-kaptcha/src/test/java/kaptcha/demo/components/Layout.java
index f15a5a8..388df77 100644
--- a/tapestry-kaptcha/src/test/java/kaptcha/demo/components/Layout.java
+++ b/tapestry-kaptcha/src/test/java/kaptcha/demo/components/Layout.java
@@ -1,4 +1,4 @@
-// Copyright 2011 The Apache Software Foundation
+// Copyright 2011-2013 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -14,6 +14,9 @@
package kaptcha.demo.components;
+import org.apache.tapestry5.annotations.Import;
+
+@Import(stack = "core")
public class Layout
{
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a586a1af/tapestry-kaptcha/src/test/resources/kaptcha/demo/components/Layout.tml
----------------------------------------------------------------------
diff --git a/tapestry-kaptcha/src/test/resources/kaptcha/demo/components/Layout.tml b/tapestry-kaptcha/src/test/resources/kaptcha/demo/components/Layout.tml
index 8156677..35e1143 100644
--- a/tapestry-kaptcha/src/test/resources/kaptcha/demo/components/Layout.tml
+++ b/tapestry-kaptcha/src/test/resources/kaptcha/demo/components/Layout.tml
@@ -1,23 +1,17 @@
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd" xmlns:p="tapestry:parameter">
- <head>
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">
+<head>
<title>${componentResources.pageName}</title>
- </head>
+</head>
+<body>
+<div class="container">
- <body>
<h1>${componentResources.pageName}</h1>
<t:body/>
- <hr/>
+ <t:pagelink class="btn btn-default" page="index">index</t:pagelink>
- <p>
- [
- <t:pagelink page="index">index</t:pagelink>
- ] |
- [
- <t:pagelink page="${componentResources.pageName}">refresh</t:pagelink>
- ]
- </p>
-
- </body>
+ <t:pagelink class="btn btn-default" page="${componentResources.pageName}">refresh</t:pagelink>
+</div>
+</body>
</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a586a1af/tapestry-kaptcha/src/test/resources/kaptcha/demo/pages/Index.tml
----------------------------------------------------------------------
diff --git a/tapestry-kaptcha/src/test/resources/kaptcha/demo/pages/Index.tml b/tapestry-kaptcha/src/test/resources/kaptcha/demo/pages/Index.tml
index 585f24a..41c57f8 100644
--- a/tapestry-kaptcha/src/test/resources/kaptcha/demo/pages/Index.tml
+++ b/tapestry-kaptcha/src/test/resources/kaptcha/demo/pages/Index.tml
@@ -1,15 +1,9 @@
-<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
+<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">
<h1>tapestry-kaptcha Demos</h1>
- <ul>
- <li>
- <t:pagelink page="kaptchaDemo">Kaptcha Demo</t:pagelink>
- </li>
- <li>
- <t:pagelink page="kaptchabeaneditformdemo">Kaptcha BeanEditForm Demo</t:pagelink>
- </li>
- </ul>
+ <t:pagelink class="btn btn-default" page="kaptchaDemo">Kaptcha Demo</t:pagelink>
+ <t:pagelink class="btn btn-default" page="kaptchabeaneditformdemo">Kaptcha BeanEditForm Demo</t:pagelink>
</t:layout>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a586a1af/tapestry-kaptcha/src/test/resources/kaptcha/demo/pages/KaptchaDemo.tml
----------------------------------------------------------------------
diff --git a/tapestry-kaptcha/src/test/resources/kaptcha/demo/pages/KaptchaDemo.tml b/tapestry-kaptcha/src/test/resources/kaptcha/demo/pages/KaptchaDemo.tml
index ba90d26..228eb0f 100644
--- a/tapestry-kaptcha/src/test/resources/kaptcha/demo/pages/KaptchaDemo.tml
+++ b/tapestry-kaptcha/src/test/resources/kaptcha/demo/pages/KaptchaDemo.tml
@@ -1,29 +1,25 @@
-<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:tx="tapestry-library:tapx">
-
- <p id="message">${message}</p>
-
- <t:form t:id="form">
- <t:errors/>
-
- <table>
- <tr>
- <td>
- <t:label for="kf"/>
- </td>
- <td>
- <t:kaptchaimage t:id="ki"/>
- <br/>
- <t:kaptchafield label="Security Check" t:id="kf" image="ki"/>
- </td>
- </tr>
- <tr>
- <td>
- </td>
- <td>
- <input type="submit" value="Go"/>
- </td>
- </tr>
- </table>
- </t:form>
+<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
+
+ <p id="message">${message}</p>
+
+
+ <t:form t:id="form">
+ <t:errors/>
+
+ <div class="form-group">
+
+ <t:kaptchaimage t:id="ki"/>
+ </div>
+
+ <div class="form-group">
+
+ <t:label for="kf" class="col-2"/>
+ <div class="col-md-2">
+ <t:kaptchafield label="Security Check" t:id="kf" image="ki"/>
+ </div>
+ </div>
+
+ <input class="btn btn-primary" type="submit" value="Go"/>
+ </t:form>
</t:layout>
\ No newline at end of file