[#416] using a simpler approach to replace node with partial
This commit is contained in:
parent
e3f54d470c
commit
4635a8c2a4
|
@ -86,10 +86,6 @@ private
|
||||||
replace_selectors = ['#watcher']
|
replace_selectors = ['#watcher']
|
||||||
end
|
end
|
||||||
|
|
||||||
watcher_partial = lambda do
|
|
||||||
render_to_string(:partial => 'watchers/watchers', :locals => {:watched => @watched})
|
|
||||||
end
|
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to :back }
|
format.html { redirect_to :back }
|
||||||
format.js do
|
format.js do
|
||||||
|
@ -99,9 +95,7 @@ private
|
||||||
|
|
||||||
case selector
|
case selector
|
||||||
when '#watchers'
|
when '#watchers'
|
||||||
page.select('#watchers').each do |node|
|
page.replace_html 'watchers', :partial => 'watchers/watchers', :locals => {:watched => @watched}
|
||||||
node.update watcher_partial.call
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
page.select(selector).each do |node|
|
page.select(selector).each do |node|
|
||||||
options = {:replace => replace_selectors}
|
options = {:replace => replace_selectors}
|
||||||
|
|
Loading…
Reference in New Issue