Sha256: e294a9c7da8e9fc94d830f6b5fcb77386a902ede3c40431fd18dfd8a324eb432

Contents?: true

Size: 1.68 KB

Versions: 2

Compression:

Stored size: 1.68 KB

Contents

module MuckCommentsHelper
  
  def show_comments(comments)
    render :partial => 'comments/comment', :collection => comments
  end
  
  # parent is the object to which the comments will be attached
  # comment is the optional parent comment for the new comment.
  def comment_form(parent, comment = nil, render_new = false, comment_button_class = 'comment-submit')
    render :partial => 'comments/form', :locals => {:parent => parent, 
                                                    :comment => comment, 
                                                    :render_new => render_new,
                                                    :comment_button_class => comment_button_class}
  end

  # make_muck_parent_params is defined in muck-engine and used by many of the engines.
  # This will generate a url suitable for a form to post a create to.
  def new_comment_path_with_parent(parent)
    comments_path(make_muck_parent_params(parent))
  end
  
  # Generates a link to the 'new' page for a comment
  def new_comment_for_path(parent)
    new_comment_path(make_muck_parent_params(parent))
  end
  
  # Renders a delete button for a comment
  def delete_comment(comment, button_type = :button, button_text = t("muck.activities.delete"))
    render :partial => 'shared/delete', :locals => { :delete_object => comment, 
                                                         :button_type => button_type,
                                                         :button_text => button_text, 
                                                         :form_class => 'comment-delete',
                                                         :delete_path => comment_path(comment, :format => 'js') }
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
muck-comments-0.1.11 app/helpers/muck_comments_helper.rb
muck-comments-0.1.10 app/helpers/muck_comments_helper.rb