apotomo
apotomo copied to clipboard
How to understand README
I don't understand the README example, but I do understand the screencasts.
root << widget('comments_widget', 'post-comments', :post => @post) end The widget is named post-comments.
You only have comments_widget defined below:
class CommentsWidget < Apotomo::Widget
Where is post-comments? What are the second arguments to widget() I thought they are paramters, like :post ?
Where is this defined in your example on the readme? The only widget you defined was CommentsWidget
= render_widget 'post-comments'
Looking at the rubydoc I got this: widget(:comments, 'post-comments', :user => current_user) sets id to 'posts_comments' and #options to the hash.
So when you did the = render_widget 'post-comments'
How will that work? That is the id of the div, not the widget name.
'post-comments'
is the widget id refering to the actual instance in the tree, which is also used in the div when using #widget_id
. There is no "widget name", only the class and the "widget id".
So by default if you do not specify the widget id it uses the class name as the ID ? Can I suggest you don't introduce that in the readme? It doesn't seem necessary for a quick readme style introduction.
Yes, and yes. Sounds good what you say :-)