You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2014/05/09 20:49:50 UTC

[1/3] git commit: Add new pages to test DateField with client validation disabled

Repository: tapestry-5
Updated Branches:
  refs/heads/master 160ed331d -> 3d0060691


Add new pages to test DateField with client validation disabled


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/98ad28ac
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/98ad28ac
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/98ad28ac

Branch: refs/heads/master
Commit: 98ad28ac9eb9f4563831275cab3f9a37b56fba68
Parents: 160ed33
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri May 9 11:40:14 2014 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri May 9 11:40:14 2014 -0700

----------------------------------------------------------------------
 .../src/test/app1/DateFieldValidationDemo.tml     | 18 ++++++++++++++++++
 .../app1/pages/DateFieldValidationDemo.groovy     | 17 +++++++++++++++++
 .../tapestry5/integration/app1/pages/Index.java   |  3 +++
 3 files changed, 38 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/98ad28ac/tapestry-core/src/test/app1/DateFieldValidationDemo.tml
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/app1/DateFieldValidationDemo.tml b/tapestry-core/src/test/app1/DateFieldValidationDemo.tml
new file mode 100644
index 0000000..022bc2a
--- /dev/null
+++ b/tapestry-core/src/test/app1/DateFieldValidationDemo.tml
@@ -0,0 +1,18 @@
+<html t:type="Border"
+      xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd">
+
+    <h1>DateField Validation Demo</h1>
+
+    <t:form clientValidation="none">
+        <t:errors/>
+
+        <div class="field-group ">
+            <t:label for="date"/>
+            <t:datefield t:id="date"/>
+        </div>
+
+        <input type="submit" value="Go" class="btn btn-primary"/>
+
+    </t:form>
+
+</html>

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/98ad28ac/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/pages/DateFieldValidationDemo.groovy
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/pages/DateFieldValidationDemo.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/pages/DateFieldValidationDemo.groovy
new file mode 100644
index 0000000..014d81e
--- /dev/null
+++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/pages/DateFieldValidationDemo.groovy
@@ -0,0 +1,17 @@
+package org.apache.tapestry5.integration.app1.pages
+
+import org.apache.tapestry5.alerts.AlertManager
+import org.apache.tapestry5.annotations.Property
+import org.apache.tapestry5.ioc.annotations.Inject
+
+class DateFieldValidationDemo {
+
+    Date date;
+
+    @Inject
+    private AlertManager alertManager;
+
+    void onSuccess() {
+        alertManager.success(String.format("Submitted date as '%s'.", date));
+    }
+}

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/98ad28ac/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
index b516ef7..009a97d 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
@@ -57,6 +57,9 @@ public class Index
     private static final List<Item> ITEMS = CollectionFactory
             .newList(
 
+                    new Item ("DateFieldValidationDemo", "DateField Validation Demo",
+                            "Use of DateField component when client validation is disabled."),
+
                     new Item("MixinParameters54", "Strict Mixin Parameters", "In the 5.4 DTD, Parameter Mixins must be qualified with the mixin id."),
 
                     new Item("AsyncDemo", "Async Links and Forms Demo", "Async (XHR) Updates without a containing Zone."),


[2/3] git commit: Make use of the t5/core/dom#scanner function

Posted by hl...@apache.org.
Make use of the t5/core/dom#scanner function


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/1b851058
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/1b851058
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/1b851058

Branch: refs/heads/master
Commit: 1b851058e4d71c2349f64624da89fe9b02ba48a5
Parents: 98ad28a
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri May 9 11:40:46 2014 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri May 9 11:40:46 2014 -0700

----------------------------------------------------------------------
 .../META-INF/modules/t5/core/datefield.coffee        | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1b851058/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee
index aca4653..6d57b17 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee
@@ -147,20 +147,13 @@ define ["./dom", "./events", "./messages", "./ajax", "underscore", "./datepicker
             @hidePopup()
 
 
-    scan = (root) ->
-      for container in root.find "[data-component-type='core/DateField']"
-        # Hide it from later scans
-        container.attr "data-component-type", null
-
-        new Controller(container)
-
     # Initialization:
 
-    scan dom.body
-
-    # And scan any newly added content:
+    dom.scanner "[data-component-type='core/DateField']", (container) ->
+      # Hide it from later scans
+      container.attr "data-component-type", null
 
-    dom.onDocument events.zone.didUpdate, -> scan this
+      new Controller(container)
 
     # Exports nothing.
     return null


[3/3] git commit: TAP5-805: Always show the popup, even when the text field can't be parsed

Posted by hl...@apache.org.
TAP5-805: Always show the popup, even when the text field can't be parsed


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/3d006069
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/3d006069
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/3d006069

Branch: refs/heads/master
Commit: 3d00606918a0a6b9123678e0adf844b58288d3db
Parents: 1b85105
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri May 9 11:49:43 2014 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri May 9 11:49:43 2014 -0700

----------------------------------------------------------------------
 .../META-INF/modules/t5/core/datefield.coffee          | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3d006069/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee
index 6d57b17..530f6f6 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee
@@ -88,6 +88,9 @@ define ["./dom", "./events", "./messages", "./ajax", "underscore", "./datepicker
             @field.removeClass "ajax-wait"
             @fieldError message
 
+            @showPopup()
+            return
+
           success: (response) =>
             @field.removeClass "ajax-wait"
             reply = response.json
@@ -98,11 +101,13 @@ define ["./dom", "./events", "./messages", "./ajax", "underscore", "./datepicker
               date = new Date()
               date.setTime reply.result
               @datePicker.setDate date
-              @showPopup()
-              return
 
-            @fieldError (_.escape reply.error)
-            @hidePopup()
+            if reply.error
+              @fieldError (_.escape reply.error)
+
+              @datePicker.setDate null
+
+            @showPopup()
             return
 
       fieldError: (message) ->


[3/3] git commit: TAP5-805: Always show the popup, even when the text field can't be parsed

Posted by hl...@apache.org.
TAP5-805: Always show the popup, even when the text field can't be parsed


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/3d006069
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/3d006069
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/3d006069

Branch: refs/heads/master
Commit: 3d00606918a0a6b9123678e0adf844b58288d3db
Parents: 1b85105
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri May 9 11:49:43 2014 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri May 9 11:49:43 2014 -0700

----------------------------------------------------------------------
 .../META-INF/modules/t5/core/datefield.coffee          | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3d006069/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee
index 6d57b17..530f6f6 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee
@@ -88,6 +88,9 @@ define ["./dom", "./events", "./messages", "./ajax", "underscore", "./datepicker
             @field.removeClass "ajax-wait"
             @fieldError message
 
+            @showPopup()
+            return
+
           success: (response) =>
             @field.removeClass "ajax-wait"
             reply = response.json
@@ -98,11 +101,13 @@ define ["./dom", "./events", "./messages", "./ajax", "underscore", "./datepicker
               date = new Date()
               date.setTime reply.result
               @datePicker.setDate date
-              @showPopup()
-              return
 
-            @fieldError (_.escape reply.error)
-            @hidePopup()
+            if reply.error
+              @fieldError (_.escape reply.error)
+
+              @datePicker.setDate null
+
+            @showPopup()
             return
 
       fieldError: (message) ->


[2/3] git commit: Make use of the t5/core/dom#scanner function

Posted by hl...@apache.org.
Make use of the t5/core/dom#scanner function


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/1b851058
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/1b851058
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/1b851058

Branch: refs/heads/master
Commit: 1b851058e4d71c2349f64624da89fe9b02ba48a5
Parents: 98ad28a
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri May 9 11:40:46 2014 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri May 9 11:40:46 2014 -0700

----------------------------------------------------------------------
 .../META-INF/modules/t5/core/datefield.coffee        | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1b851058/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee
index aca4653..6d57b17 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/datefield.coffee
@@ -147,20 +147,13 @@ define ["./dom", "./events", "./messages", "./ajax", "underscore", "./datepicker
             @hidePopup()
 
 
-    scan = (root) ->
-      for container in root.find "[data-component-type='core/DateField']"
-        # Hide it from later scans
-        container.attr "data-component-type", null
-
-        new Controller(container)
-
     # Initialization:
 
-    scan dom.body
-
-    # And scan any newly added content:
+    dom.scanner "[data-component-type='core/DateField']", (container) ->
+      # Hide it from later scans
+      container.attr "data-component-type", null
 
-    dom.onDocument events.zone.didUpdate, -> scan this
+      new Controller(container)
 
     # Exports nothing.
     return null