[Jifty-commit] jifty branch, master, updated. f1f16ea87f6cea671ec5ee1b5888e652c97485e1

Jifty commits jifty-commit at lists.jifty.org
Sat May 22 01:29:32 EDT 2010


The branch, master has been updated
       via  f1f16ea87f6cea671ec5ee1b5888e652c97485e1 (commit)
      from  443130c46ef8ed526350d81002c2e6f8994727e1 (commit)

Summary of changes:
 share/web/static/js/jifty.js |   69 ++++++++++++++++++++++++++++-------------
 1 files changed, 47 insertions(+), 22 deletions(-)

- Log -----------------------------------------------------------------
commit f1f16ea87f6cea671ec5ee1b5888e652c97485e1
Author: c9s <cornelius.howl at gmail.com>
Date:   Sat May 22 05:39:22 2010 +0800

    Update js region document and added a region helper function

diff --git a/share/web/static/js/jifty.js b/share/web/static/js/jifty.js
index b3c1efe..afb442b 100644
--- a/share/web/static/js/jifty.js
+++ b/share/web/static/js/jifty.js
@@ -1102,28 +1102,53 @@ var apply_fragment_updates = function(fragment, f) {
     }
 }
 
-// Update a region. It takes two arguments.
-//
-// The first argument is a hash of named parameters, including:
-//  - 'actions' is an array of monikers to submit
-//  - 'action_arguments' is a hash of action monikers to hashes of arguments which should override any arguments coming from form fields
-//        the hash keys for 'action_arguments' are the values of the 'actions' array
-//  - 'continuation' is ??? Please document me
-//  - 'hide_wait_message' for when you don't want to see it
-//  - 'preload' this request is preloading regions
-//  - 'preload_key' the cache key for using preloaded regions
-//  - 'headers' is a hash of headers to send in this request
-//  - 'fragments' is an array of hashes, which may have:
-//     - 'region' is the name of the region to update
-//     - 'args' is a hash of arguments to override
-//     - 'path' is the path of the fragment (if this is a new fragment)
-//     - 'element' is the CSS selector of the element to update, if 'region' isn't supplied
-//     - 'mode' is one of 'Replace', 'Top', 'Bottom', 'Before', or 'After'
-//     - 'effect' is the name of an effect
-//
-// The second argument is the element (usually a submit button) that triggered
-// it.
-//
+/* Region update helper 
+ *  Jifty.replaceRegion( 'region-name' , '/path' , { id: 123123 , msg: 'blah'  } );
+ */
+Jifty.updateRegion = function( regionName , path , args , mode ) {
+    Jifty.update({
+        fragments: [{ region: '__page-' + regionName ,
+            args: args, path: path, mode: mode ? mode : 'Replace' }]
+    });
+};
+
+/* Update a region. It takes two arguments.
+  
+   Usage:
+
+    Jifty.update({
+        fragments: [{
+            region: '__page-region_name' ,
+            args: { id => 123  }
+            path: '/path_to_replace',
+            mode: 'Replace'
+        }]
+    });
+   
+   Description:
+
+   The first argument is a hash of named parameters, including:
+    - 'actions' is an array of monikers to submit
+    - 'action_arguments' is a hash of action monikers to hashes of arguments which should override any arguments coming from form fields
+          the hash keys for 'action_arguments' are the values of the 'actions' array
+    - 'continuation' is ??? Please document me
+    - 'hide_wait_message' for when you don't want to see it
+    - 'preload' this request is preloading regions
+    - 'preload_key' the cache key for using preloaded regions
+    - 'headers' is a hash of headers to send in this request
+    - 'fragments' is an array of hashes, which may have:
+       - 'region' is the name of the region to update
+       - 'args' is a hash of arguments to override
+       - 'path' is the path of the fragment (if this is a new fragment)
+       - 'element' is the CSS selector of the element to update, if 'region' isn't supplied
+       - 'mode' is one of 'Replace', 'Top', 'Bottom', 'Before', or 'After'
+       - 'effect' is the name of an effect
+  
+    The second argument is the element (usually a submit button) that triggered
+    it.
+ */
+
+
 Jifty.update = function () {
     // Let the regular form submit take over if this browser can't do this
     if (!Jifty.hasAjaxTransport) return true;

-----------------------------------------------------------------------


More information about the Jifty-commit mailing list