Created
June 14, 2011 14:40
-
-
Save paneq/1025029 to your computer and use it in GitHub Desktop.
Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/controllers/bubbles_controller.rb | |
class BubblesController < ApplicationController | |
has_widgets do |root| | |
root << widget(:facebook) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#app/widgets/facebook/display.html.erb | |
<%= widget_div do %> | |
<%= rand %> | |
<h1 id="12"> | |
FacebookWidget#display | |
</h1> | |
<p> | |
Find me in app/widgets/facebook/display.html.erb | |
</p> | |
<%= link_to "Submit", url_for_event(:submit), :remote => true %> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/widgets/facebook_widget.rb | |
class FacebookWidget < Apotomo::Widget | |
responds_to_event :submit, :with => :process_submit | |
def display | |
render | |
end | |
def process_submit(evt) | |
replace(:state => :display) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("facebook").replace("<div id=facebook>0.14460199105946114<h1 id=12> FacebookWidget#displayh1><p> Find me in app/widgets/facebook/display.html.erbp><a href=/bubbles/render_event_response?source=facebook&type=submit data-remote=true>Submita>div>"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#app/views/bubbles/index.html.erb | |
<%= render_widget :facebook %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("facebook").replace("<div id=\"facebook\">\n\n0.5280982822732676\n\n<h1 id=\"12\">\n FacebookWidget#display\n<\/h1>\n\n<p>\n Find me in app/widgets/facebook/display.html.erb\n<\/p>\n\n<a href=\"/bubbles/render_event_response?source=facebook&type=submit\" data-remote=\"true\">Submit<\/a>\n\n<\/div>"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment