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 2014/09/02 01:18:43 UTC

[3/6] git commit: Tweak code for handling Ajax updates triggered by changing a Select

Tweak code for handling Ajax updates triggered by changing a Select


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

Branch: refs/heads/master
Commit: 3475b4dd2de35232ddb9044531c8fba4d7de5bea
Parents: 145b368
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Mon Sep 1 15:45:10 2014 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Mon Sep 1 15:45:10 2014 -0700

----------------------------------------------------------------------
 .../META-INF/modules/t5/core/select.coffee        | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3475b4dd/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/select.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/select.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/select.coffee
index 23c05e2..bf2f856 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/select.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/select.coffee
@@ -1,5 +1,3 @@
-# Copyright 2012 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.
 # You may obtain a copy of the License at
@@ -20,11 +18,15 @@ define ["./events", "./dom", "./zone"],
 
   (events, dom, zone) ->
 
-        dom.onDocument "change", "select[data-update-zone]", ->
+    dom.onDocument "change", "select[data-update-zone]", ->
+
+      containingZone = zone.findZone this
 
-          containingZone = zone.findZone this
+      if containingZone
+        containingZone.trigger events.zone.refresh,
+          url: @attr "data-update-url"
+          parameters:
+            "t:selectvalue": @value()
 
-          containingZone and containingZone.trigger events.zone.refresh,
-            url: @attr "data-update-url"
-            parameters:
-              "t:selectvalue": @value()
+      return
+    return