[Jifty-commit] r3526 - jifty/branches/trimclient/share/web/static/js

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Mon Jun 18 04:41:42 EDT 2007


Author: clkao
Date: Mon Jun 18 04:41:41 2007
New Revision: 3526

Modified:
   jifty/branches/trimclient/share/web/static/js/jifty.js

Log:
Actually register actions so it works!

Modified: jifty/branches/trimclient/share/web/static/js/jifty.js
==============================================================================
--- jifty/branches/trimclient/share/web/static/js/jifty.js	(original)
+++ jifty/branches/trimclient/share/web/static/js/jifty.js	Mon Jun 18 04:41:41 2007
@@ -23,7 +23,7 @@
 		      'actions': action_hash,
 		      'fragments': [{'mode': 'Replace', 'args': {}, 'region':'__page_signup_widget', 'path': '_signup'}]})
     +', this)';
-    onclick = onclick.replace(/"/g, "'");
+    onclick = onclick.replace(/"/g, "'"); //"' # grr emacs!
     outs(
 	 div(function() {
 		 attr(function() { return ['class', 'submit_button'] });
@@ -40,11 +40,22 @@
 
  };
 
+function register_action(a) {
+    outs(div(function() {
+		attr(function() { return ['class', 'hidden'] });
+		return input(function() { attr(function() {
+				return ['type', 'hidden',
+					'name', a.register_name(),
+					'id', a.register_name(),
+					'value', a.actionClass] }) } ) } ));
+    /* XXX: fallback values */
+}
 
 function apply_cached_for_action(code, actions) {
     Jifty.Web.current_actions = actions;
     this['out_buf'] = '';
     this['outs'] = function(text) { this.out_buf += text };
+    actions.each(register_action);
     var foo = code();
     return foo;
     alert(foo);
@@ -307,7 +318,8 @@
 	var type = 'text';
 	var f = new ActionField(field, a_s[field], this);
 	return f.render();
-    }
+    },
+    register_name: function() { return this.register.id }
 
 };
 
@@ -378,7 +390,7 @@
     },
  render_hints: function() {
 	var tthis = this;
-	span(function(){attr(function(){return ['class', "hints"]});
+	return span(function(){attr(function(){return ['class', "hints"]});
 		return tthis.hints });
     },
 
@@ -386,9 +398,8 @@
 	if (!this.action) return '';
 	var tthis = this;
 	// XXX: post-request handler needs to extract field error messages
-	span(function(){attr(function(){return ['class', "error", 'id', 'errors-'+tthis.input_name()]});
+	return span(function(){attr(function(){return ['class', "error", 'id', 'errors-'+tthis.input_name()]});
 		return tthis.error });
-	return '';
     },
 
  render_widget: function () {


More information about the Jifty-commit mailing list