pakyow-presenter/lib/presenter/view.rb in pakyow-presenter-0.9.0 vs pakyow-presenter/lib/presenter/view.rb in pakyow-presenter-0.9.1
- old
+ new
@@ -86,11 +86,10 @@
def prepend(view)
@doc.prepend(view.doc)
end
- #TODO allow strings?
def after(view)
@doc.after(view.doc)
end
def before(view)
@@ -297,14 +296,18 @@
bind_data_to_root(data, scope, bindings, ctx)
scope_info[:props].each do |prop_info|
catch(:unbound) do
prop = prop_info[:prop]
+ doc = prop_info[:doc]
+ if DocHelpers.form_field?(doc.tagname)
+ set_form_field_name(doc, scope, prop)
+ end
+
if data_has_prop?(data, prop) || Binder.instance.has_scoped_prop?(scope, prop, bindings)
- value = Binder.instance.value_for_scoped_prop(scope, prop, data, bindings, ctx)
- doc = prop_info[:doc]
+ value = Binder.instance.value_for_scoped_prop(scope, prop, data, bindings, ctx)
if DocHelpers.form_field?(doc.tagname)
bind_to_form_field(doc, scope, prop, value, data, ctx)
end
@@ -346,11 +349,9 @@
doc.html = value
end
end
def bind_to_form_field(doc, scope, prop, value, bindable, ctx)
- set_form_field_name(doc, scope, prop)
-
# special binding for checkboxes and radio buttons
if doc.tagname == 'input' && (doc.get_attribute(:type) == 'checkbox' || doc.get_attribute(:type) == 'radio')
bind_to_checked_field(doc, value)
# special binding for selects
elsif doc.tagname == 'select'