src/drivers/jquery/modules/o_O.support.js in eyeballs-0.5.10.1 vs src/drivers/jquery/modules/o_O.support.js in eyeballs-0.5.11
- old
+ new
@@ -6,22 +6,37 @@
object[field.attr('data-attribute')] = callback(field);
}
return object;
}
-o_O.params = function(form){
- return o_O.find_attributes(form, function(field){
- if(field.is('[type=radio]'))
- {
- return $('[data-attribute=' + field.attr('data-attribute') + ']:checked').val()
- }
- else
- {
- return field.val();
- }
- });
+o_O.params_from_form = function(form){
+ return $.deparam(form.serialize());
+}
+
+o_O.params = function(param, new_value){
+ if(new_value != void(0))
+ {
+ o_O.params.collection[param] = new_value;
+ return new_value;
}
+ if(typeof param === 'string')
+ {
+ return o_O.params.collection[param];
+ }
+ return o_O.params.collection;
+}
+
+o_O.params.collection = {}
+
+$(function(){
+ $('body').delegate('form', 'submit', function(){
+ for(param in o_O.params_from_form($(this)))
+ {
+ o_O.params(param, o_O.params_from_form($(this))[param]);
+ }
+ })
+})
o_O.render = function(template, data, options){
o_O.get_template(template, data, function(data, template){
var rendered = Mustache.to_html(template, data);
if(typeof options === 'object')
@@ -39,9 +54,17 @@
$(options.replace).replaceWith(rendered);
}
if(options.html)
{
$(options.html).html(rendered);
+ }
+ if(options.before)
+ {
+ $(options.html).before(rendered);
+ }
+ if(options.after)
+ {
+ $(options.html).after(rendered);
}
}
});
}
\ No newline at end of file