Guest User

Untitled

a guest
May 25th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.38 KB | None | 0 0
  1. diff --git a/share/web/static/js/jifty.js b/share/web/static/js/jifty.js
  2. index b3c1efe..afb442b 100644
  3. --- a/share/web/static/js/jifty.js
  4. +++ b/share/web/static/js/jifty.js
  5. @@ -1102,28 +1102,53 @@ var apply_fragment_updates = function(fragment, f) {
  6. }
  7. }
  8.  
  9. -// Update a region. It takes two arguments.
  10. -//
  11. -// The first argument is a hash of named parameters, including:
  12. -// - 'actions' is an array of monikers to submit
  13. -// - 'action_arguments' is a hash of action monikers to hashes of arguments which should override any arguments coming from form fields
  14. -// the hash keys for 'action_arguments' are the values of the 'actions' array
  15. -// - 'continuation' is ??? Please document me
  16. -// - 'hide_wait_message' for when you don't want to see it
  17. -// - 'preload' this request is preloading regions
  18. -// - 'preload_key' the cache key for using preloaded regions
  19. -// - 'headers' is a hash of headers to send in this request
  20. -// - 'fragments' is an array of hashes, which may have:
  21. -// - 'region' is the name of the region to update
  22. -// - 'args' is a hash of arguments to override
  23. -// - 'path' is the path of the fragment (if this is a new fragment)
  24. -// - 'element' is the CSS selector of the element to update, if 'region' isn't supplied
  25. -// - 'mode' is one of 'Replace', 'Top', 'Bottom', 'Before', or 'After'
  26. -// - 'effect' is the name of an effect
  27. -//
  28. -// The second argument is the element (usually a submit button) that triggered
  29. -// it.
  30. -//
  31. +/* Region update helper
  32. + * Jifty.replaceRegion( 'region-name' , '/path' , { id: 123123 , msg: 'blah' } );
  33. + */
  34. +Jifty.updateRegion = function( regionName , path , args , mode ) {
  35. + Jifty.update({
  36. + fragments: [{ region: '__page-' + regionName ,
  37. + args: args, path: path, mode: mode ? mode : 'Replace' }]
  38. + });
  39. +};
  40. +
  41. +/* Update a region. It takes two arguments.
  42. +
  43. + Usage:
  44. +
  45. + Jifty.update({
  46. + fragments: [{
  47. + region: '__page-region_name' ,
  48. + args: { id => 123 }
  49. + path: '/path_to_replace',
  50. + mode: 'Replace'
  51. + }]
  52. + });
  53. +
  54. + Description:
  55. +
  56. + The first argument is a hash of named parameters, including:
  57. + - 'actions' is an array of monikers to submit
  58. + - 'action_arguments' is a hash of action monikers to hashes of arguments which should override any arguments coming from form fields
  59. + the hash keys for 'action_arguments' are the values of the 'actions' array
  60. + - 'continuation' is ??? Please document me
  61. + - 'hide_wait_message' for when you don't want to see it
  62. + - 'preload' this request is preloading regions
  63. + - 'preload_key' the cache key for using preloaded regions
  64. + - 'headers' is a hash of headers to send in this request
  65. + - 'fragments' is an array of hashes, which may have:
  66. + - 'region' is the name of the region to update
  67. + - 'args' is a hash of arguments to override
  68. + - 'path' is the path of the fragment (if this is a new fragment)
  69. + - 'element' is the CSS selector of the element to update, if 'region' isn't supplied
  70. + - 'mode' is one of 'Replace', 'Top', 'Bottom', 'Before', or 'After'
  71. + - 'effect' is the name of an effect
  72. +
  73. + The second argument is the element (usually a submit button) that triggered
  74. + it.
  75. + */
  76. +
  77. +
  78. Jifty.update = function () {
  79. // Let the regular form submit take over if this browser can't do this
  80. if (!Jifty.hasAjaxTransport) return true;
Add Comment
Please, Sign In to add comment