README.rdoc in apotomo-1.0.5 vs README.rdoc in apotomo-1.1.0.rc1

- old
+ new

@@ -40,11 +40,11 @@ == Generate Go and generate a widget stub. - $ rails generate apotomo:widget CommentsWidget display write --haml + $ rails generate apotomo:widget CommentsWidget 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 @@ -82,22 +82,22 @@ A widget is like a cell which is like a mini-controller. class CommentsWidget < Apotomo::Widget responds_to_event :submit, :with => :write - def display - @comments = param(:post).comments # the parameter from outside. + def display(args) + @comments = args[:post].comments # the parameter from outside. render end Having +display+ as the default state when rendering, this method collects comments to show and renders its view. And look at line 2 - if encountering a <tt>:submit</tt> event we invoke +write+, which is simply another state. How cool is that? - def write - @comment = Comment.new(:post => param(:post)) - @comment.update_attributes param(:comment) # like params[]. + def write(evt) + @comment = Comment.new(:post_id => evt[:post_id]) + @comment.update_attributes evt[:comment] # a bit like params[]. update :state => :display end end @@ -158,12 +158,12 @@ $("post-comments").replaceWith(<the rendered view>); If that's not what you want, do - def write - if param(:comment)[:text].explicit? + def write(evt) + if evt[:comment][:text].explicit? render :text => 'alert("Hey, you wanted to submit a pervert comment!");' end end Apotomo doesn't depend on _any_ JS framework - you choose! @@ -208,6 +208,6 @@ If you wanna be cool, subscribe to our feed[http://feeds.feedburner.com/Apotomo]! == License -Copyright (c) 2007-2010 Nick Sutterer <apotonick@gmail.com> under the MIT License +Copyright (c) 2007-2011 Nick Sutterer <apotonick@gmail.com> under the MIT License