mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
make observers a little more dry
This commit is contained in:
committed by
Stefan Penner
parent
49e84a5943
commit
f115fb0111
@@ -60,7 +60,6 @@ module ActionView
|
||||
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 @@ module ActionView
|
||||
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 @@ module ActionView
|
||||
|
||||
def extract_observer_attributes!(options)
|
||||
attributes = extract_remote_attributes!(options)
|
||||
attributes["data-observe"] = true
|
||||
attributes["data-observed"] = options.delete(:observed)
|
||||
|
||||
callback = options.delete(:function)
|
||||
|
||||
Reference in New Issue
Block a user