How to understand README #52

Open
amalagaura opened this Issue Dec 26, 2011 · 4 comments

Projects

None yet

2 participants

@amalagaura

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'

@amalagaura

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.

@apotonick
Owner

'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".

@amalagaura

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.

@apotonick
Owner

Yes, and yes. Sounds good what you say :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment