Module | Apotomo::JavascriptMethods |
In: |
lib/apotomo/widget/javascript_methods.rb
|
Wraps the rendered content in a replace statement according to your +Apotomo.js_framework+ setting. Received the same options as render plus an optional selector to change the selector.
Example (with Apotomo.js_framework = :jquery):
def hungry replace
will render the current state‘s view and wrap it like
"jQuery(\"#mouse\").replaceWith(\"<div id=\\\"mouse\\\">hungry!<\\/div>\")"
You may pass a selector and pass options to render here, as well.
replace "#jerry h1", :view => :squeak #=> "jQuery(\"#jerry h1\").replaceWith(\"<div id=\\\"mouse\\\">squeak!<\\/div>\")"