README.rdoc in apotomo-1.2.2 vs README.rdoc in apotomo-1.2.3

- old
+ new

@@ -42,11 +42,11 @@ == Generate Go and generate a widget stub. - $ rails generate apotomo:widget CommentsWidget display write -e haml + $ rails generate apotomo:widget Comments display write -e haml create app/cells/ create app/cells/comments_widget create app/cells/comments_widget.rb create app/cells/comments_widget/display.html.haml create app/cells/comments_widget/write.html.haml @@ -60,14 +60,14 @@ class PostsController < ApplicationController include Apotomo::Rails::ControllerMethods has_widgets do |root| - root << widget('comments_widget', 'post-comments', :post => @post) + root << widget(:comments, :post => @post) end -The widget is named <tt>post-comments</tt>. We pass the current post into the widget - the block is executed in controller instance context, that's were <tt>@post</tt> comes from. Handy, isn't it? +This creates a widget instance called <tt>comments_widget</tt> from the class CommentsWidget. We pass the current post into the widget - the block is executed in controller instance context, that's were <tt>@post</tt> comes from. Handy, isn't it? == Render the widget Rendering usually happens in your controller view, <tt>views/posts/show.html.haml</tt>, for instance. @@ -75,11 +75,11 @@ %p @post.body %p - = render_widget 'post-comments' + = render_widget :comments == Write the widget A widget is like a cell which is like a mini-controller. @@ -146,11 +146,11 @@ Also, updating the page is in your hands. Where Apotomo provides handy helpers as +#replace+, you could also <b>emit your own JavaScript</b>. Look, +replace+ basically generates - $("post-comments").replaceWith(<the rendered view>); + $("comments").replaceWith(<the rendered view>); If that's not what you want, do def post(evt) if evt[:comment][:text].explicit? @@ -164,15 +164,15 @@ Apotomo comes with its own test case and assertions to <b>build rock-solid web components</b>. class CommentsWidgetTest < Apotomo::TestCase has_widgets do |root| - root << widget(:comments_widget, 'me', :post => @pervert_post) + root << widget(:comments, :post => @pervert_post) end def test_render - render_widget 'me' + render_widget :comments assert_select "li#me" trigger :post, :comment => {:text => "Sex on the beach"} assert_response 'alert("Hey, you wanted to submit a pervert comment!");' end @@ -200,6 +200,6 @@ If you wanna be cool, subscribe to our feed[http://feeds.feedburner.com/Apotomo]! == License -Copyright (c) 2007-2011 Nick Sutterer <apotonick@gmail.com> under the MIT License +Copyright (c) 2007-2012 Nick Sutterer <apotonick@gmail.com> under the MIT License