Module: Discussion::CommentsHelper

Defined in:
app/helpers/discussion/comments_helper.rb

Instance Method Summary collapse

Instance Method Details

#load_comments_for(commentable, options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/helpers/discussion/comments_helper.rb', line 3

def load_comments_for(commentable, options={})
  remote = options[:remote] || false
  comments_container_id = "comments-#{Time.now.to_i}"
  if remote
    "    <div id='\#{comments_container_id}' class=\"comments_container\">Loading comments ...</div>\n    <script type='text/javascript'>\n      Disussion.loadComments('\#{polymorphic_url([commentable, :comments])}', '\#{comments_container_id}');\n    </script>\n    EOF\n  else\n    content_tag :div, id: comments_container_id do\n      render :partial => \"discussion/comments/list_with_form\", locals: {commentable: commentable, contriner_id: comments_container_id}\n    end\n  end\nend\n".html_safe