[Bounty] 1 pizza for 1 simple plugin

So here’s the deal. I don’t know the innards of rails well enough to
do this quickly but you might. First person to write this and release
it under MIT license or public domain, and tells me, gets a free
pizza from your favorite local delivery place. You pick the toppings,
I’ll call 'em and order it up for you. Yeah a pizza isn’t much but I’m
relatively broke and this is probably a quicky, would be useful to
many people, and an interesting challenge for someone.

I want a plugin that will add the following HTML comment to the top
and bottom of EVERY rendered rhtml page. This includes all partials
and layout files.

normally rendered page here.

Reasoning:
This allows you to just “view source” on any web page and see exactly
what file your bug is in. I’ve been doing it manually for years and it
can save a lot of time.

Restrictions:
Has to ONLY affect pages destined for browsers, not web services or
anything like that. Obviously it has to be the actual path no just the
static string “path/from/rails/root/to/some/file.rhtml”

It’s preferable to have no config required at all. Just drop the
plugin in. Indicating what actions it would apply to in the controller
would be fine too. Specifying something in every file you want it to
appear around isn’t acceptable since you may as well put that tags in
yourself if you’re going to do that.

Clarification:
Just to be clear this would result in a page that was littered with
these comments around the layout, and essentially every render_* tag.
If you had a render in a loop it would end up with these comments
around every one.

The Textmate Footnotes plugin (http://agilewebdevelopment.com/plugins/
textmate_footnotes) by Canada Duane (http://inquirylabs.com/) does
something close to what you want. It doesn’t handle partials, but it
will give you Textmate links to the view and controller loaded in the
browser.


Benjamin C.
http://www.bencurtis.com/
http://www.tesly.com/ – Collaborative test case management
http://www.agilewebdevelopment.com/ – Resources for the Rails community

On 6/21/06, Benjamin C. [email protected] wrote:

The Textmate Footnotes plugin (http://agilewebdevelopment.com/plugins/
textmate_footnotes) by Canada Duane (http://inquirylabs.com/) does
something close to what you want. It doesn’t handle partials, but it
will give you Textmate links to the view and controller loaded in the
browser.

yeah, I need all, especially partials, and I run linux so Textmate
doesn’t really help me.

but thanks for the tip.

-kate = masukomi

< 3 hours turnaround. wow. I used to work for PeopleSoft and our
internal distribution lists were that good, nice to see it working out
in the open.

Can I have a slice of pizza?

yb

Richard L. wrote:

kate rhodes wrote:

but thanks for the tip.
I’ve emailed kate off list with a zip of a quick plugin which does what
she wants. My SVN is playing up at the moment, but I’ll put it up there
when it’s back to normality.

In the meantime, if anyone wants a copy too then drop me a line and I’ll
send them the zip.

Thanks - was a fun little exercise digging around Rails :o)

kate rhodes wrote:

but thanks for the tip.
I’ve emailed kate off list with a zip of a quick plugin which does what
she wants. My SVN is playing up at the moment, but I’ll put it up there
when it’s back to normality.

In the meantime, if anyone wants a copy too then drop me a line and I’ll
send them the zip.

Thanks - was a fun little exercise digging around Rails :o)

Richard:

I developed something similar to this a long time ago… what did you
end up
using? Just overriding ActionView::Base#render?

Richard I don’t see a means of contacting you other than posting here.
I’d like a copy of the zip, please.

many tks.

Cayce B. wrote:

Richard I don’t see a means of contacting you other than posting here.
I’d like a copy of the zip, please.

many tks.

I’ve put it here temporarily.

http://livsey.org/files/annotate_renders.zip

Thanks.

Brian H. wrote:

Richard:

I developed something similar to this a long time ago… what did you
end up using? Just overriding ActionView::Base#render?

Pretty much yeah. Noticed it all gets called to
ActionView::Base#render_file so overrode that.

I’ve emailed kate off list with a zip of a quick plugin which does what
she wants. My SVN is playing up at the moment, but I’ll put it up there
when it’s back to normality.

Hooray for Richard!
It works great. Absolute paths instead of relative but that’s close
enough for pizza!

Haven’t tested against web services and all that.

Don’t forget to add it to the Rails Plugins Dir when you get your svn
up Richard.
http://plugins.radrails.org/

Thanks Richard.

probably a good idea to remove the \n in it. I didn’t think of it when
i originally posted but every now and then you have to get rid of
whitespace in html because the browsers decide to do stupid things
with it.

so where’s the pizza? :slight_smile:

Richard L. schrieb:

kate rhodes wrote:

probably a good idea to remove the \n in it. I didn’t think of it when
i originally posted but every now and then you have to get rid of
whitespace in html because the browsers decide to do stupid things
with it.

Good point. The whitespace did make it easier to read, but yeah some
browsers (IE especially) may freak! Have removed that.

The paths are now from the rails root, and it only outputs the paths in
development mode (or when logger.debug? is true).

My svn is back up now, so it’s available at
http://svn.livsey.org/plugins/

Oh, and don’t worry about the pizza - I did it for fun :o)

Thanks!

Posted at http://agilewebdevelopment.com/plugins/annotate_renders :slight_smile:


Benjamin C.
http://www.bencurtis.com/
http://www.tesly.com/ – Collaborative test case management
http://www.agilewebdevelopment.com/ – Resources for the Rails community

The paths are now from the rails root, and it only outputs the paths in
development mode (or when logger.debug? is true).

ooh i like that idea.

My svn is back up now, so it’s available at
http://svn.livsey.org/plugins/

yay

Oh, and don’t worry about the pizza - I did it for fun :o)

whoot. :slight_smile:
Thanks again richard.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs