Skip to content
This repository has been archived by the owner on Dec 21, 2022. It is now read-only.

Commit

Permalink
updating readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben VandenBos committed Sep 23, 2008
1 parent f32b024 commit e7bed84
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
14 changes: 14 additions & 0 deletions README
Expand Up @@ -3,4 +3,18 @@ render_partial_comments

Simple plugin for adding begin/end partial html comments to render output in development mode.

install
=======

ruby script/plugin install git://github.com/avvo/render_partial_comments.git

useage
=====

Nothing to setup, just install the plugin.

It should add something like the following to your rendered pages (in development mode).

<!-- render_begin 'user/view' -->
...
<!-- render_end 'user/view' -->
18 changes: 9 additions & 9 deletions lib/render_partial_comments.rb
@@ -1,27 +1,27 @@
# these should all be defined...
ActionView::Base

module ActionView::Base
class ActionView::Base

private

def self.perform_partial_comments?
# TODO: make this some kind of configuration in environments
RAILS_ENV == 'development'
end

# don't even define this method if we don't want to
if preform_partial_comments?
# don't even define this method if we don't want it enabled
if perform_partial_comments?

# render_partial(partial_path, object_assigns = nil, local_assigns = {})
def render_partial_with_comments(partial_path, object_assigns = nil, local_assigns = {})
r = ''
r << %{<!-- render_start '#{template_path}' -->} if self.class.perform_partial_comments?
r << render_for_file_without_comments(template_path, state, layout, locals)
r << %{<!-- render_end '#{template_path}' -->} if self.class.perform_partial_comments?
r = %{<!-- render_begin '#{partial_path}' -->}
r << render_partial_without_comments(partial_path, object_assigns, local_assigns)
r << %{<!-- render_end '#{partial_path}' -->}
r
end

alias_method_chain :render_partial, :comments

end
end

0 comments on commit e7bed84

Please sign in to comment.