How to get access to variables in partials?

This is probably a stupid question, but please bear with me!

I am currently removing the admin_parts dependency from the comments
extension, and replacing this with shards instead, as I feel this
will make all happy, and will be better supported in the future.

I am also trying to add some extra stuff, and this is where I get
into trouble.

I am trying to extend the node_row region with a link to the comments
for the current page. In CommentsExtension I have:

admin.page.index.add :node_row, “index_view_comments”

This works great, but the problem is getting the current page into
the index_view_comments partial.

The solution is probably easy, and since I have already tried to
long, I though I just ask for some expert help here :slight_smile:

Greetings

Hans-Christian Fjeldberg
[email protected]

Hans,

I needed that functionality myself and thought it would be especially
appropriate for the sitemap rows, so I added it this morning.
Essentially the options passed to render_region are passed on to the
individual partials. In this case, :locals => {:page => page, :level =>
level} is passed. Then you have those variables accessible within your
partial.

I have some ideas about how to better modularize the sitemap, including
a core patch to cleanup _node.rhtml, but I’d entertain some suggestions
– especially ones derived from real usage scenarios.

Sean

That worked, thank you.

I’ll try to release my patches for the comments extension tomorrow
Norwegian time…

As I do not know exactly how the site-map works, I don’t have any
great ideas, but I do agree _node.rhtml has a lot of code that should
rather be in a helper or something.

Greetings

Hans-Christian Fjeldberg
[email protected]