提交 f115fb01 编写于 作者: S Stephen St. Martin 提交者: Stefan Penner

make observers a little more dry

上级 49e84a59
......@@ -60,7 +60,6 @@ def periodically_call_remote(options = {})
def observe_field(name, options = {})
options[:observed] = name
attributes = extract_observer_attributes!(options)
attributes["data-observe"] = true
script_decorator(attributes)
end
......@@ -68,7 +67,6 @@ def observe_field(name, options = {})
def observe_form(name, options = {})
options[:observed] = name
attributes = extract_observer_attributes!(options)
attributes["data-js-type"] = "form_observer"
script_decorator(attributes)
end
......@@ -130,6 +128,7 @@ def extract_update_attributes!(options)
def extract_observer_attributes!(options)
attributes = extract_remote_attributes!(options)
attributes["data-observe"] = true
attributes["data-observed"] = options.delete(:observed)
callback = options.delete(:function)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册