Easy Way to identify Partials

Hey there,
here we have a bunch of interns, so called marketing specialists and
other
folks just pushing out more and more layouts, views and partials. Now
when
theres a SEO wanting to change a link on page A to point to landing page
123 isntead of landing page 234 it can be a pain to jsut find the file
where this link is generated.

Do you know of an easy way to identify which part of a page comes from
which partial file? Perhaps a plugin adding a border or something?

Greeting Mike

Your log file lists all of the partials that are rendered to build up a
page - is that enough information? mine looks like this for example.

Rendered ratings/_rate (258.6ms)
Rendered resources/_single_resource (268.7ms)
Rendered resources/_resource (276.7ms)
Rendered resources/_property_hyperlinks (1.6ms)
Rendered resources/_note_tag_list (0.8ms)
Rendered taggings/_tags_section (1.4ms)

listing those has highlighted the fact that some of them are very slow,
must go and see if i can optimise them…

Thanks for your. I was already aware of the log file. It is OK, but it
would
be fine if i had some hints in the rendered HTML.

Something like

Flux Compensator

Showing you a Product

Product Name: Flux Compensator Parts: Hypercapacitor Gizmo

Thank you for your interest in Flux Compensator

Index

It would be lovely if there was a plugin that accomplishes this. I would
also appreciate any hint as to how achieve this functionality.

Thanks, Mike

On Mon, Oct 12, 2009 at 3:08 PM, Max W. <

Greg D. wrote:

On Mon, Oct 12, 2009 at 3:29 AM, [email protected] wrote:

Do you know of an easy way to identify which part of a page comes from which
partial file? Perhaps a plugin adding a border or something?

This will add comments to your erb templates:

[…]

Ooh, neat! I’ll have to play with that – thanks for sharing it.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Yay, thank you Greg!

On Wed, Oct 14, 2009 at 12:06 AM, Marnen Laibow-Koser <

On Mon, Oct 12, 2009 at 3:29 AM, [email protected] wrote:

Do you know of an easy way to identify which part of a page comes from which
partial file? Perhaps a plugin adding a border or something?

This will add comments to your erb templates:

unless RAILS_ENV == ‘production’
module ActionView
module TemplateHandlers
class ERB < TemplateHandler
include Compilable
cattr_accessor :erb_trim_mode
self.erb_trim_mode = ‘-’
def compile(template)
src = ::ERB.new(“<% __in_erb_template=true %>\n\n#{ template.source}\n\n”,
nil, erb_trim_mode, ‘@output_buffer’).src
RUBY_VERSION >= ‘1.9’ ? src.sub(/\A#coding:.*\n/, ‘’) : src
end
end
end
end
end

Mine lives in my environment.rb.


Greg D.
http://destiney.com/

On Oct 13, 9:16 pm, mike [email protected] wrote:

It would be lovely if there was a plugin that accomplishes this. I would
also appreciate any hint as to how achieve this functionality.

I wrote this a little while ago: GitHub - fcheung/tattler

Fred

Nice Plugin!

Greg, your solution works great. However, it can interfere with js
templates. So i added <% if request and request.xhr? %> to the
injected code.
Frederick, will look into it when im in the office :slight_smile:
Greetings

2009/10/13, Greg D. [email protected]:

module TemplateHandlers
  end


Von meinen Mobilgerät aus gesendet