apotomo icon indicating copy to clipboard operation
apotomo copied to clipboard

How to understand README

Open amalagaura opened this issue 12 years ago • 4 comments

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 avatar Dec 26 '11 21:12 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.

amalagaura avatar Dec 26 '11 21:12 amalagaura

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

apotonick avatar Dec 27 '11 17:12 apotonick

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.

amalagaura avatar Dec 27 '11 17:12 amalagaura

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

apotonick avatar Dec 27 '11 17:12 apotonick