khemlall mangal

Joined

1,030 Experience
7 Lessons Completed
0 Questions Solved

Activity

Chris i followed your tutorial with polymorphic true commenting system, but i ran into an issue with trying to use ajax to refresh the page. The page does not refresh, only when i reload the page am i seeing the value.. any help is appreciated

Comments Controller
def create
@comment = @commentable.comments.new comment_params
@comment.user_id = current_user.id
@comment.user = current_user
respond_to do |format|
if @comment.save
format.html {redirect_to @commentable, notice: "successfully created"}
format.js
else
format.html { render :action => "new" }
format.json {render json: @commentable }
#redirect_to @commentable, alert: "Opps unable to post comment"
#render format.js
format.js
end
end
end

Routes

resources :createcampaigns do
resource :like, module: :createcampaigns
resources :campaignsteps, controller: 'createcampaigns/campaignsteps'
resources :organizers
resources :categories
** resources :comments, module: :createcampaigns**
resources :replies, module: :createcampaign
member do
get :follow
post :signpetition
get :likecomment
get :dislikedcomment

  post :upvote
  post :downvote
  get 'like'
  get 'unlike'
  post :follow
  get :likecampaign
  get :unlikecampaign
  get :unfollow
  post :unfollow
  post :destroy
  get :zipcodeURL
   get :search, controller: :main
end

end

COMMENTS FORM
_FORM.HTML.ERB

<%=form_for [commentable, Comment.new], remote:true, local: true, html: { class: local_assigns[:class] , data: {target: local_assigns[:target] }} do |f|%>

<%= f.text_area :body, class: "form-control", placeholder: "Whats on your mind?"%> <%= f.hidden_field :parent_id, value: local_assigns[:parent_id] %>

<%=f.submit class:"btn btn-primary"%>

<% end %>

_COMMENTS.HTML.ERB

<% commentable.comments.where(parent_id: nil).order(created_at: :desc).each do |comments|%>

<%=image_tag(User.find(comments.user_id).image, class: "profile-photo-md pull-left")%>
<%=User.find(comments.user_id).first_name%> <%=User.find(comments.user_id).last_name%> following <% if current_user.liked? comments %> <%= link_to "", unlike_createcampaign_path(comments.id), remote: true, id: "like_#{comments.id}", class: "glyphicon glyphicon-heart" %> <% else %> <%= link_to "", like_createcampaign_path(comments.id), remote: true, id: "like_#{comments.id}", class: "glyphicon glyphicon-heart-empty" %> <% end %> <%=current_user.party%>
<% if comments.created_at > Time.now.beginning_of_day %>

Posted <%="#{time_ago_in_words(comments.created_at)} ago"%>

<% else %> <%= comments.created_at.strftime("%b %d, %Y" )%> <% end %>
              <div class="reaction">
                <a class="btn text-green"><i class="fa fa-thumbs-up"></i><%=comments.votes_for.size%><br> </a>
                <%=link_to "Liked", upvote_createcampaign_path(comments), method: :post%>
                <a class="btn text-red"><i class="fa fa-thumbs-down"></i> <%=comments.get_downvotes.size %></a>
                <%=link_to "DIS-LIKE", downvote_createcampaign_path(comments), method: :post %>



              </div>
              <div class="line-divider"></div>
              <div class="post-text">
                <p><%=comments.body%></p>

                <%#= react_component 'Main' %>

                   <div class="text-right">
                   <button type="button" class="btn btn-xl btn-primary btn-rounded" data-toggle="modal" data-target="#<%=comments.id%>">
                    ADD A REPLY
                  </button>
                  </div>
              </div>

                 <!-- Button trigger modal -->


        <!-- Modal -->
        <div class="modal fade" id="<%=comments.id%>" tabindex="-1">
          <div class="modal-dialog modal-lg">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">×</button>
                <h4 class="modal-title">Add a Reply</h4>
              </div>
              <div class="modal-body">
                <%= render partial: "comments/form", locals: {commentable: comments.commentable, parent_id: comments.id, class: "", target: "reply.form" }%>
              </div>
            </div>
          </div>
        </div>
              <!-- if Reply exist, then show these by the user -->
              <div class="line-divider"></div>

              <div class="panel">
      <div class="panel-heading">

      <%@pagination = commentable.comments.where(parent_id: comments.id).paginate(:page => params[:page], :per_page => 5).order("created_at DESC")%>
        <%@replycount = commentable.comments.where(parent_id: comments.id)%>
        <span class="panel-title"><%=@replycount.count%> Replies to <%=User.find(comments.user_id).first_name%> <%=User.find(comments.user_id).last_name%> Comment</span>
      </div>
      <% commentable.comments.where(parent_id: comments.id).limit(3).order(created_at: :desc).each do |reply|%> 
      <div class="widget-messages-alt-item">

         <%=image_tag(User.find(reply.user_id).image, class: "widget-messages-alt-avatar")%>
        <div  class="widget-messages-alt-subject"><%=reply.body%> </div>
        <div class="widget-messages-alt-description">from <a href="#"> <%=User.find(reply.user_id).first_name%> <%=User.find(reply.user_id).last_name%></a></div>
        <% if reply.created_at > Time.now.beginning_of_day %>
             <p class="widget-messages-alt-date"> Replied <%="#{time_ago_in_words(reply.created_at)} ago"%>  </p>
                 <% else %>
                   <span class="Replied">  <%= reply.created_at.strftime("%b %d, %Y" )%>   </span>
                 <% end %>

      </div> 

      <%end%>
          <% if @replycount.count>3%>
      <a  class="widget-more-link" data-toggle="modal" data-target="#commentModal<%=comments.id%>">MORE MESSAGES</a>
      <%end%> 


             CREATE CAMPAIGN SHOW PAGE

             SHOW.html.erb

              <div class="panel">
           <div class="panel-title">
              <h1> Comments </h1>
           </div>
            <div id="comment_pane">
           <%= render partial: "comments/comments", locals: {commentable: @createcampaign}%>
           </div>

           <div class="panel-body">
           </div>
        </div>
     </div>
    </div>
  </div>


        comments/comments/create.js.erb  

        $('#comment_pane).prepend("<%=j render 'comments/comments', commentable: @commentable %>");
$('#comment_content_<%= @comment.id %>').val('')


    here is the response in the network tab

    $('#comment_pane).prepend("\n\n<div id=\"comment_pane\">\n<link href=\"https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css\" rel=\"stylesheet\">\n<div class=\"container\" id=\"comment_190\">\n    <div class=\"row\">\n        <div class=\"col-md-9\">\n            <div class=\"post-content\">\n              <div class=\"post-container\">\n                <img class=\"profile-photo-md pull-left\" src=\"https://chymeinuserupload.s3.amazonaws.com/uploads/user/image/2/man-person-suit-united-states-of-america.jpg\" alt=\"Man person suit united states of america\" />\n                <div class=\"post-detail\">\n                  <div class=\"user-info\">\n                    <h5><a href=\"timeline.html\" class=\"profile-link\">Donald trump<\/a> <span class=\"following\">following\n                          <a id=\"like_190\" class=\"glyphicon glyphicon-heart-empty\" data-remote=\"true\" href=\"/createcampaigns/190/like\"><\/a>\n                    \n                     Republican\n                    \n                    <\/span><\/h5>\n                 <p class=\"text-muted\"> Posted less than a minute ago  <\/p>\n                  <\/div>\n                  <div class=\"reaction\">\n                    <a class=\"btn text-green\"><i class=\"fa fa-thumbs-up\"><\/i>0<br> <\/a>\n                    <a rel=\"nofollow\" data-method=\"post\" href=\"/createcampaigns/190/upvote\">Liked<\/a>\n                    <a class=\"btn text-red\"><i class=\"fa fa-thumbs-down\"><\/i> 0<\/a>\n                    <a rel=\"nofollow\" data-method=\"post\" href=\"/createcampaigns/190/downvote\">DIS-LIKE<\/a>\n                    \n                    \n                    \n                  <\/div>\n                  <div class=\"line-divider\"><\/div>\n                  <div class=\"post-text\">\n                    <p>prepend<\/p>\n                    \n                    \n                       <div class=\"text-right\">\n                       <button type=\"button\" class=\"btn btn-xl btn-primary btn-rounded\" data-toggle=\"modal\" data-target=\"#190\">\n                        ADD A REPLY\n                      <\/button>\n                      <\/div>\n                  <\/div>\n             \n                     <!-- Button trigger modal -->\n         \n\n            <!-- Modal -->\n            <div class=\"modal fade\" id=\"190\" tabindex=\"-1\">\n              <div class=\"modal-dialog modal-lg\">\n                <div class=\"modal-content\">\n                  <div class=\"modal-header\">\n                    <button type=\"button\" class=\"close\" data-dismiss=\"modal\">×<\/button>\n                    <h4 class=\"modal-title\">Add a Reply<\/h4>\n                  <\/div>\n                  <div class=\"modal-body\">\n                    \n<form class=\"\" data-target=\"reply.form\" id=\"new_comment\" action=\"/createcampaigns/206/comments\" accept-charset=\"UTF-8\" data-remote=\"true\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" />\n<div class=\"form-group\">\n<textarea class=\"form-control\" placeholder=\"Whats on your mind?\" name=\"comment[body]\" id=\"comment_body\">\n<\/textarea>\n<input value=\"190\" type=\"hidden\" name=\"comment[parent_id]\" id=\"comment_parent_id\" />\n\n<\/div>\n<input type=\"submit\" name=\"commit\" value=\"Create Comment\" class=\"btn btn-primary\" />\n\n<\/form>\n\n                  <\/div>\n                <\/div>\n              <\/div>\n            <\/div>\n                  <!-- if Reply exist, then show these by the user -->\n                  <div class=\"line-divider\"><\/div>\n                  \n                  <div class=\"panel\">\n          <div class=\"panel-heading\">\n           \n            <span class=\"panel-title\">0 Replies to Donald trump Comment<\/span>\n          <\/div>\n         \n        <\/div>\n    \n\n\n\n<!-- The Modal for all comments list-->\n<div class=\"modal\" id=\"commentModal190\">\n  <div class=\"modal-dialog\">\n    <div class=\"modal-content\">\n\n      <!-- Modal Header -->\n      <div class=\"modal-header\">\n        <h4 class=\"modal-title\">View All Messages<\/h4>\n        <button type=\"button\" class=\"close\" data-dismiss=\"modal\">&times;<\/button>\n      <\/div>\n\n      <!-- Modal body -->\n      <div class=\"modal-body\">\n           here is where the list of all comment going to be appearing\n                \n                  <div class=\"panel\">\n          <div class=\"panel-heading\">\n            <span class=\"panel-title\">0 Replies to Donald trump Comment<\/span>\n          <\/div>\n               \n\n          <a href=\"#\" class=\"widget-more-link\">MORE MESSAGES<\/a>\n        <\/div>\n      <\/div>\n\n      <!-- Modal footer -->\n      <div class=\"modal-footer\">\n        <button type=\"button\" class=\"btn btn-danger\" data-dismiss=\"modal\">Close<\/button>\n      <\/div>\n\n    <\/div>\n  <\/div>\n<\/div>    \n             \n             \n                <\/div>\n              <\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n   \n<\/div>\n\n<link href=\"https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css\" rel=\"stylesheet\">\n<div class=\"container\" id=\"comment_189\">\n    <div class=\"row\">\n        <div class=\"col-md-9\">\n            <div class=\"post-content\">\n              <div class=\"post-container\">\n                <img class=\"profile-photo-md pull-left\" src=\"https://chymeinuserupload.s3.amazonaws.com/uploads/user/image/2/man-person-suit-united-states-of-america.jpg\" alt=\"Man person suit united states of america\" />\n                <div class=\"post-detail\">\n                  <div class=\"user-info\">\n                    <h5><a href=\"timeline.html\" class=\"profile-link\">Donald trump<\/a> <span class=\"following\">following\n                          <a id=\"like_189\" class=\"glyphicon glyphicon-heart-empty\" data-remote=\"true\" href=\"/createcampaigns/189/like\"><\/a>\n                    \n                     Republican\n                    \n                    <\/span><\/h5>\n                 <p class=\"text-muted\"> Posted 2 minutes ago  <\/p>\n                  <\/div>\n                  <div class=\"reaction\">\n                    <a class=\"btn text-green\"><i class=\"fa fa-thumbs-up\"><\/i>0<br> <\/a>\n                    <a rel=\"nofollow\" data-method=\"post\" href=\"/createcampaigns/189/upvote\">Liked<\/a>\n                    <a class=\"btn text-red\"><i class=\"fa fa-thumbs-down\"><\/i> 0<\/a>\n                    <a rel=\"nofollow\" data-method=\"post\" href=\"/createcampaigns/189/downvote\">DIS-LIKE<\/a>\n                    \n                    \n                    \n                  <\/div>\n                  <div class=\"line-divider\"><\/div>\n                  <div class=\"post-text\">\n                    <p>ccccffsdf<\/p>\n                    \n                    \n                       <div class=\"text-right\">\n                       <button type=\"button\" class=\"btn btn-xl btn-primary btn-rounded\" data-toggle=\"modal\" data-target=\"#189\">\n                        ADD A REPLY\n                      <\/button>\n                      <\/div>\n                  <\/div>\n             \n                     <!-- Button trigger modal -->\n         \n\n            <!-- Modal -->\n            <div class=\"modal fade\" id=\"189\" tabindex=\"-1\">\n              <div class=\"modal-dialog modal-lg\">\n                <div class=\"modal-content\">\n                  <div class=\"modal-header\">\n                    <button type=\"button\" class=\"close\" data-dismiss=\"modal\">×<\/button>\n                    <h4 class=\"modal-title\">Add a Reply<\/h4>\n                  <\/div>\n                  <div class=\"modal-body\">\n                    \n<form class=\"\" data-target=\"reply.form\" id=\"new_comment\" action=\"/createcampaigns/206/comments\" accept-charset=\"UTF-8\" data-remote=\"true\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" />\n<div class=\"form-group\">\n<textarea class=\"form-control\" placeholder=\"Whats on your mind?\" name=\"comment[body]\" id=\"comment_body\">\n<\/textarea>\n<input value=\"189\" type=\"hidden\" name=\"comment[parent_id]\" id=\"comment_parent_id\" />\n\n<\/div>\n<input type=\"submit\" name=\"commit\" value=\"Create Comment\" class=\"btn btn-primary\" />\n\n<\/form>\n\n                  <\/div>\n                <\/div>\n              <\/div>\n            <\/div>\n                  <!-- if Reply exist, then show these by the user -->\n                  <div class=\"line-divider\"><\/div>\n                  \n                  <div class=\"panel\">\n          <div class=\"panel-heading\">\n           \n            <span class=\"panel-title\">0 Replies to Donald trump Comment<\/span>\n          <\/div>\n         \n        <\/div>\n    \n\n\n\n<!-- The Modal for all comments list-->\n<div class=\"modal\" id=\"commentModal189\">\n  <div class=\"modal-dialog\">\n    <div class=\"modal-content\">\n\n      <!-- Modal Header -->\n      <div class=\"modal-header\">\n        <h4 class=\"modal-title\">View All Messages<\/h4>\n        <button type=\"button\" class=\"close\" data-dismiss=\"modal\">&times;<\/button>\n      <\/div>\n\n      <!-- Modal body -->\n      <div class=\"modal-body\">\n           here is where the list of all comment going to be appearing\n                \n                  <div class=\"panel\">\n          <div class=\"panel-heading\">\n            <span class=\"panel-title\">0 Replies to Donald trump Comment<\/span>\n          <\/div>\n               \n\n          <a href=\"#\" class=\"widget-more-link\">MORE MESSAGES<\/a>\n        <\/div>\n      <\/div>\n\n      <!-- Modal footer -->\n      <div class=\"modal-footer\">\n        <button type=\"button\" class=\"btn btn-danger\" data-dismiss=\"modal\">Close<\/button>\n      <\/div>\n\n    <\/div>\n  <\/div>\n<\/div>    \n             \n             \n                <\/div>\n              <\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n   \n<\/div>\n\n<link href=\"https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css\" rel=\"stylesheet\">\n<div class=\"container\" id=\"comment_188\">\n    <div class=\"row\">\n        <div class=\"col-md-9\">\n            <div class=\"post-content\">\n              <div class=\"post-container\">\n                <img class=\"profile-photo-md pull-left\" src=\"https://chymeinuserupload.s3.amazonaws.com/uploads/user/image/2/man-person-suit-united-states-of-america.jpg\" alt=\"Man person suit united states of america\" />\n                <div class=\"post-detail\">\n                  <div class=\"user-info\">\n                    <h5><a href=\"timeline.html\" class=\"profile-link\">Donald trump<\/a> <span class=\"following\">following\n                          <a id=\"like_188\" class=\"glyphicon glyphicon-heart-empty\" data-remote=\"true\" href=\"/createcampaigns/188/like\"><\/a>\n                    \n                     Republican\n                    \n                    <\/span><\/h5>\n                 <p class=\"text-muted\"> Posted 3 minutes ago  <\/p>\n                  <\/div>\n                  <div class=\"reaction\">\n                    <a class=\"btn text-green\"><i class=\"fa fa-thumbs-up\"><\/i>0<br> <\/a>\n                    <a rel=\"nofollow\" data-method=\"post\" href=\"/createcampaigns/188/upvote\">Liked<\/a>\n                    <a class=\"btn text-red\"><i class=\"fa fa-thumbs-down\"><\/i> 0<\/a>\n                    <a rel=\"nofollow\" data-method=\"post\" href=\"/createcampaigns/188/downvote\">DIS-LIKE<\/a>\n                    \n                    \n                    \n                  <\/div>\n                  <div class=\"line-divider\"><\/div>\n                  <div class=\"post-text\">\n                    <p>cccc<\/p>\n                    \n                    \n                       <div class=\"text-right\">\n                       <button type=\"button\" class=\"btn btn-xl btn-primary btn-rounded\" data-toggle=\"modal\" data-target=\"#188\">\n                        ADD A REPLY\n                      <\/button>\n                      <\/div>\n                  <\/div>\n             \n                     <!-- Button trigger modal -->\n         \n\n            <!-- Modal -->\n            <div class=\"modal fade\" id=\"188\" tabindex=\"-1\">\n              <div class=\"modal-dialog modal-lg\">\n                <div class=\"modal-content\">\n                  <div class=\"modal-header\">\n                    <button type=\"button\" class=\"close\" data-dismiss=\"modal\">×<\/button>\n                    <h4 class=\"modal-title\">Add a Reply<\/h4>\n                  <\/div>\n                  <div class=\"modal-body\">\n                    \n<form class=\"\" data-target=\"reply.form\" id=\"new_comment\" action=\"/createcampaigns/206/comments\" accept-charset=\"UTF-8\" data-remote=\"true\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" />\n<div class=\"form-group\">\n<textarea class=\"form-control\" placeholder=\"Whats on your mind?\" name=\"comment[body]\" id=\"comment_body\">\n<\/textarea>\n<input value=\"188\" type=\"hidden\" name=\"comment[parent_id]\" id=\"comment_parent_id\" />\n\n<\/div>\n<input type=\"submit\" name=\"commit\" value=\"Create Comment\" class=\"btn btn-primary\" />\n\n<\/form>\n\n                  <\/div>\n                <\/div>\n              <\/div>\n            <\/div>\n                  <!-- if Reply exist, then show these by the user -->\n                  <div class=\"line-divider\"><\/div>\n                  \n                  <div class=\"panel\">\n          <div class=\"panel-heading\">\n           \n            <span class=\"panel-title\">0 Replies to Donald trump Comment<\/span>\n          <\/div>\n         \n        <\/div>\n    \n\n\n\n<!-- The Modal for all comments list-->\n<div class=\"modal\" id=\"commentModal188\">\n  <div class=\"modal-dialog\">\n    <div class=\"modal-content\">\n\n      <!-- Modal Header -->\n      <div class=\"modal-header\">\n        <h4 class=\"modal-title\">View All Messages<\/h4>\n        <button type=\"button\" class=\"close\" data-dismiss=\"modal\">&times;<\/button>\n      <\/div>\n\n      <!-- Modal body -->\n      <div class=\"modal-body\">\n           here is where the list of all comment going to be appearing\n                \n                  <div class=\"panel\">\n          <div class=\"panel-heading\">\n            <span class=\"panel-title\">0 Replies to Donald trump Comment<\/span>\n          <\/div>\n               \n\n          <a href=\"#\" class=\"widget-more-link\">MORE MESSAGES<\/a>\n        <\/div>\n      <\/div>\n\n      <!-- Modal footer -->\n      <div class=\"modal-footer\">\n        <button type=\"button\" class=\"btn btn-danger\" data-dismiss=\"modal\">Close<\/button>\n      <\/div>\n\n    <\/div>\n  <\/div>\n<\/div>    \n             \n             \n                <\/div>\n              <\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n   \n<\/div>\n\n<link href=\"https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css\" rel=\"stylesheet\">\n<div class=\"container\" id=\"comment_187\">\n    <div class=\"row\">\n        <div class=\"col-md-9\">\n            <div class=\"post-content\">\n              <div class=\"post-container\">\n                <img class=\"profile-photo-md pull-left\" src=\"https://chymeinuserupload.s3.amazonaws.com/uploads/user/image/2/man-person-suit-united-states-of-america.jpg\" alt=\"Man person suit united states of america\" />\n                <div class=\"post-detail\">\n                  <div class=\"user-info\">\n                    <h5><a href=\"timeline.html\" class=\"profile-link\">Donald trump<\/a> <span class=\"following\">following\n                          <a id=\"like_187\" class=\"glyphicon glyphicon-heart-empty\" data-remote=\"true\" href=\"/createcampaigns/187/like\"><\/a>\n                    \n                     Republican\n                    \n                    <\/span><\/h5>\n                 <p class=\"text-muted\"> Posted 4 minutes ago  <\/p>\n                  <\/div>\n                  <div class=\"reaction\">\n                    <a class=\"btn text-green\"><i class=\"fa fa-thumbs-up\"><\/i>0<br> <\/a>\n                    <a rel=\"nofollow\" data-method=\"post\" href=\"/createcampaigns/187/upvote\">Liked<\/a>\n                    <a class=\"btn text-red\"><i class=\"fa fa-thumbs-down\"><\/i> 0<\/a>\n                    <a rel=\"nofollow\" data-method=\"post\" href=\"/createcampaigns/187/downvote\">DIS-LIKE<\/a>\n                    \n                    \n                    \n                  <\/div>\n                  <div class=\"line-divider\"><\/div>\n                  <div class=\"post-text\">\n                    <p>dere<\/p>\n                    \n                    \n                       <div class=\"text-right\">\n                       <button type=\"button\" class=\"btn btn-xl btn-primary btn-rounded\" data-toggle=\"modal\" data-target=\"#187\">\n                        ADD A REPLY\n                      <\/button>\n                      <\/div>\n                  <\/div>\n             \n                     <!-- Button trigger modal -->\n         \n\n            <!-- Modal -->\n            <div class=\"modal fade\" id=\"187\" tabindex=\"-1\">\n              <div class=\"modal-dialog modal-lg\">\n                <div class=\"modal-content\">\n                  <div class=\"modal-header\">\n                    <button type=\"button\" class=\"close\" data-dismiss=\"modal\">×<\/button>\n                    <h4 class=\"modal-title\">Add a Reply<\/h4>\n                  <\/div>\n                  <div class=\"modal-body\">\n                    \n<form class=\"\" data-target=\"reply.form\" id=\"new_comment\" action=\"/createcampaigns/206/comments\" accept-charset=\"UTF-8\" data-remote=\"true\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" />\n<div class=\"form-group\">\n<textarea class=\"form-control\" placeholder=\"Whats on your mind?\" name=\"comment[body]\" id=\"comment_body\">\n<\/textarea>\n<input value=\"187\" type=\"hidden\" name=\"comment[parent_id]\" id=\"comment_parent_id\" />\n\n<\/div>\n<input type=\"submit\" name=\"commit\" value=\"Create Comment\" class=\"btn btn-primary\" />\n\n<\/form>\n\n                  <\/div>\n                <\/div>\n              <\/div>\n            <\/div>\n                  <!-- if Reply exist, then show these by the user -->\n                  <div class=\"line-divider\"><\/div>\n                  \n                  <div class=\"panel\">\n          <div class=\"panel-heading\">\n           \n            <span class=\"panel-title\">0 Replies to Donald trump Comment<\/span>\n          <\/div>\n         \n        <\/div>\n    \n\n\n\n<!-- The Modal for all comments list-->\n<div class=\"modal\" id=\"commentModal187\">\n  <div class=\"modal-dialog\">\n    <div class=\"modal-content\">\n\n      <!-- Modal Header -->\n      <div class=\"modal-header\">\n        <h4 class=\"modal-title\">View All Messages<\/h4>\n        <button type=\"button\" class=\"close\" data-dismiss=\"modal\">&times;<\/button>\n      <\/div>\n\n      <!-- Modal body -->\n      <div class=\"modal-body\">\n           here is where the list of all comment going to be appearing\n                \n                  <div class=\"panel\">\n          <div class=\"panel-heading\">\n            <span class=\"panel-title\">0 Replies to Donald trump Comment<\/span>\n          <\/div>\n               \n\n          <a href=\"#\" class=\"widget-more-link\">MORE MESSAGES<\/a>\n        <\/div>\n      <\/div>\n\n      <!-- Modal footer -->\n      <div class=\"modal-footer\">\n        <button type=\"button\" class=\"btn btn-danger\" data-dismiss=\"modal\">Close<\/button>\n      <\/div>\n\n    <\/div>\n  <\/div>\n<\/div>    \n             \n             \n                <\/div>\n              <\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n   \n<\/div>\n\n<link href=\"https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css\" rel=\"stylesheet\">\n<div class=\"container\" id=\"comment_186\">\n    <div class=\"row\">\n        <div class=\"col-md-9\">\n            <div class=\"post-content\">\n              <div class=\"post-container\">\n                <img class=\"profile-photo-md pull-left\" src=\"https://chymeinuserupload.s3.amazonaws.com/uploads/user/image/2/man-person-suit-united-states-of-america.jpg\" alt=\"Man person suit united states of america\" />\n                <div class=\"post-detail\">\n                  <div class=\"user-info\">\n                    <h5><a href=\"timeline.html\" class=\"profile-link\">Donald trump<\/a> <span class=\"following\">following\n                          <a id=\"like_186\" class=\"glyphicon glyphicon-heart-empty\" data-remote=\"true\" href=\"/createcampaigns/186/like\"><\/a>\n                    \n                     Republican\n                    \n                    <\/span><\/h5>\n                 <p class=\"text-muted\"> Posted 5 minutes ago  <\/p>\n                  <\/div>\n                  <div class=\"reaction\">\n                    <a class=\"btn text-green\"><i class=\"fa fa-thumbs-up\"><\/i>0<br> <\/a>\n                    <a rel=\"nofollow\" data-method=\"post\" href=\"/createcampaigns/186/upvote\">Liked<\/a>\n                    <a class=\"btn text-red\"><i class=\"fa fa-thumbs-down\"><\/i> 0<\/a>\n                    <a rel=\"nofollow\" data-method=\"post\" href=\"/createcampaigns/186/downvote\">DIS-LIKE<\/a>\n                    \n                    \n                    \n                  <\/div>\n                  <div class=\"line-divider\"><\/div>\n                  <div class=\"post-text\">\n                    <p>sdsd<\/p>\n                    \n                    \n                       <div class=\"text-right\">\n                       <button type=\"button\" class=\"btn btn-xl btn-primary btn-rounded\" data-toggle=\"modal\" data-target=\"#186\">\n                        ADD A REPLY\n                      <\/button>\n                      <\/div>\n                  <\/div>\n             \n                     <!-- Button trigger modal -->\n         \n\n            <!-- Modal -->\n            <div class=\"modal fade\" id=\"186\" tabindex=\"-1\">\n              <div class=\"modal-dialog modal-lg\">\n                <div class=\"modal-content\">\n                  <div class=\"modal-header\">\n                    <button type=\"button\" class=\"close\" data-dismiss=\"modal\">×<\/button>\n                    <h4 class=\"modal-title\">Add a Reply<\/h4>\n                  <\/div>\n                  <div class=\"modal-body\">\n                    \n<form class=\"\" data-target=\"reply.form\" id=\"new_comment\" action=\"/createcampaigns/206/comments\" accept-charset=\"UTF-8\" data-remote=\"true\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" />\n<div class=\"form-group\">\n<textarea class=\"form-control\" placeholder=\"Whats on your mind?\" name=\"comment[body]\" id=\"comment_body\">\n<\/textarea>\n<input value=\"186\" type=\"hidden\" name=\"comment[parent_id]\" id=\"comment_parent_id\" />\n\n<\/div>\n<input type=\"submit\" name=\"commit\" value=\"Create Comment\" class=\"btn btn-primary\" />\n\n<\/form>\n\n                  <\/div>\n                <\/div>\n              <\/div>\n            <\/div>\n                  <!-- if Reply exist, then show these by the user -->\n                  <div class=\"line-divider\"><\/div>\n                  \n                  <div class=\"panel\">\n          <div class=\"panel-heading\">\n           \n            <span class=\"panel-title\">0 Replies to Donald trump Comment<\/span>\n          <\/div>\n         \n        <\/div>\n    \n\n\n\n<!-- The Modal for all comments list-->\n<div class=\"modal\" id=\"commentModal186\">\n  <div class=\"modal-dialog\">\n    <div class=\"modal-content\">\n\n      <!-- Modal Header -->\n      <div class=\"modal-header\">\n        <h4 class=\"modal-title\">View All Messages<\/h4>\n        <button type=\"button\" class=\"close\" data-dismiss=\"modal\">&times;<\/button>\n      <\/div>\n\n      <!-- Modal body -->\n      <div class=\"modal-body\">\n           here is where the list of all comment going to be appearing\n                \n                  <div class=\"panel\">\n          <div class=\"panel-heading\">\n            <span class=\"panel-title\">0 Replies to Donald trump Comment<\/span>\n          <\/div>\n               \n\n          <a href=\"#\" class=\"widget-more-link\">MORE MESSAGES<\/a>\n        <\/div>\n      <\/div>\n\n      <!-- Modal footer -->\n      <div class=\"modal-footer\">\n        <button type=\"button\" class=\"btn btn-danger\" data-dismiss=\"modal\">Close<\/button>\n      <\/div>\n\n    <\/div>\n  <\/div>\n<\/div>    \n             \n             \n                <\/div>\n              <\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n   \n<\/div>\n\n<link href=\"https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css\" rel=\"stylesheet\">\n<div class=\"container\" id=\"comment_185\">\n    <div class=\"row\">\n        <div class=\"col-md-9\">\n            <div class=\"post-content\">\n              <div class=\"post-container\">\n                <img class=\"profile-photo-md pull-left\" src=\"https://chymeinuserupload.s3.amazonaws.com/uploads/user/image/2/man-person-suit-united-states-of-america.jpg\" alt=\"Man person suit united states of america\" />\n                <div class=\"post-detail\">\n                  <div class=\"user-info\">\n                    <h5><a href=\"timeline.html\" class=\"profile-link\">Donald trump<\/a> <span class=\"following\">following\n                          <a id=\"like_185\" class=\"glyphicon glyphicon-heart-empty\" data-remote=\"true\" href=\"/createcampaigns/185/like\"><\/a>\n                    \n                     Republican\n                    \n                    <\/span><\/h5>\n                 <p class=\"text-muted\"> Posted 6 minutes ago  <\/p>\n                  <\/div>\n                  <div class=\"reaction\">\n                    <a class=\"btn text-green\"><i class=\"fa fa-thumbs-up\"><\/i>0<br> <\/a>\n                    <a rel=\"nofollow\" data-method=\"post\" href=\"/createcampaigns/185/upvote\">Liked<\/a>\n                    <a class=\"btn text-red\"><i class=\"fa fa-thumbs-down\"><\/i> 0<\/a>\n                    <a rel=\"nofollow\" data-method=\"post\" href=\"/createcampaigns/185/downvote\">DIS-LIKE<\/a>\n                    \n                    \n                    \n                  <\/div>\n                  <div class=\"line-divider\"><\/div>\n                  <div class=\"post-text\">\n                    <p>ok here is the commentable id<\/p>\n                    \n                    \n                       <div class=\"text-right\">\n                       <button type=\"button\" class=\"btn btn-xl btn-primary btn-rounded\" data-toggle=\"modal\" data-target=\"#185\">\n                        ADD A REPLY\n                      <\/button>\n                      <\/div>\n                  <\/div>\n             \n                     <!-- Button trigger modal -->\n         \n\n            <!-- Modal -->\n            <div class=\"modal fade\" id=\"185\" tabindex=\"-1\">\n              <div class=\"modal-dialog modal-lg\">\n                <div class=\"modal-content\">\n                  <div class=\"modal-header\">\n                    <button type=\"button\" class=\"close\" data-dismiss=\"modal\">×<\/button>\n                    <h4 class=\"modal-title\">Add a Reply<\/h4>\n                  <\/div>\n                  <div class=\"modal-body\">\n                    \n<form class=\"\" data-target=\"reply.form\" id=\"new_comment\" action=\"/createcampaigns/206/comments\" accept-charset=\"UTF-8\" data-remote=\"true\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" />\n<div class=\"form-group\">\n<textarea class=\"form-control\" placeholder=\"Whats on your mind?\" name=\"comment[body]\" id=\"comment_body\">\n<\/textarea>\n<input value=\"185\" type=\"hidden\" name=\"comment[parent_id]\" id=\"comment_parent_id\" />\n\n<\/div>\n<input type=\"submit\" name=\"commit\" value=\"Create Comment\" class=\"btn btn-primary\" />\n\n<\/form>\n\n                  <\/div>\n                <\/div>\n              <\/div>\n            <\/div>\n                  <!-- if Reply exist, then show these by the user -->\n                  <div class=\"line-divider\"><\/div>\n                  \n                  <div class=\"panel\">\n          <div class=\"panel-heading\">\n           \n            <span class=\"panel-title\">0 Replies to Donald trump Comment<\/span>\n          <\/div>\n         \n        <\/div>\n    \n\n\n\n<!-- The Modal for all comments list-->\n<div class=\"modal\" id=\"commentModal185\">\n  <div class=\"modal-dialog\">\n    <div class=\"modal-content\">\n\n      <!-- Modal Header -->\n      <div class=\"modal-header\">\n        <h4 class=\"modal-title\">View All Messages<\/h4>\n        <button type=\"button\" class=\"close\" data-dismiss=\"modal\">&times;<\/button>\n      <\/div>\n\n      <!-- Modal body -->\n      <div class=\"modal-body\">\n           here is where the list of all comment going to be appearing\n                \n                  <div class=\"panel\">\n          <div class=\"panel-heading\">\n            <span class=\"panel-title\">0 Replies to Donald trump Comment<\/span>\n          <\/div>\n               \n\n          <a href=\"#\" class=\"widget-more-link\">MORE MESSAGES<\/a>\n        <\/div>\n      <\/div>\n\n      <!-- Modal footer -->\n      <div class=\"modal-footer\">\n        <button type=\"button\" class=\"btn btn-danger\" data-dismiss=\"modal\">Close<\/button>\n      <\/div>\n\n    <\/div>\n  <\/div>\n<\/div>    \n             \n             \n                <\/div>\n              <\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n   \n<\/div>\n\n<link href=\"https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css\" rel=\"stylesheet\">\n<div class=\"container\" id=\"comment_184\">\n    <div class=\"row\">\n        <div class=\"col-md-9\">\n            <div class=\"post-content\">\n              <div class=\"post-container\">\n                <img class=\"profile-photo-md pull-left\" src=\"https://chymeinuserupload.s3.amazonaws.com/uploads/user/image/2/man-person-suit-united-states-of-america.jpg\" alt=\"Man person suit united states of america\" />\n                <div class=\"post-detail\">\n                  <div class=\"user-info\">\n                    <h5><a href=\"timeline.html\" class=\"profile-link\">Donald trump<\/a> <span class=\"following\">following\n                          <a id=\"like_184\" class=\"glyphicon glyphicon-heart-empty\" data-remote=\"true\" href=\"/createcampaigns/184/like\"><\/a>\n                    \n                     Republican\n                    \n                    <\/span><\/h5>\n                 <p class=\"text-muted\"> Posted 11 minutes ago  <\/p>\n                  <\/div>\n                  <div class=\"reaction\">\n                    <a class=\"btn text-green\"><i class=\"fa fa-thumbs-up\"><\/i>0<br> <\/a>\n                    <a rel=\"nofollow\" data-method=\"post\" href=\"/createcampaigns/184/upvote\">Liked<\/a>\n                    <a class=\"btn text-red\"><i class=\"fa fa-thumbs-down\"><\/i> 0<\/a>\n                    <a rel=\"nofollow\" data-method=\"post\" href=\"/createcampaigns/184/downvote\">DIS-LIKE<\/a>\n                    \n                    \n                    \n                  <\/div>\n                  <div class=\"line-divider\"><\/div>\n                  <div class=\"post-text\">\n                    <p>dgd<\/p>\n                    \n                    \n                       <div class=\"text-right\">\n                       <button type=\"button\" class=\"btn btn-xl btn-primary btn-rounded\" data-toggle=\"modal\" data-target=\"#184\">\n                        ADD A REPLY\n                      <\/button>\n                      <\/div>\n                  <\/div>\n             \n                     <!-- Button trigger modal -->\n         \n\n            <!-- Modal -->\n            <div class=\"modal fade\" id=\"184\" tabindex=\"-1\">\n              <div class=\"modal-dialog modal-lg\">\n                <div class=\"modal-content\">\n                  <div class=\"modal-header\">\n                    <button type=\"button\" class=\"close\" data-dismiss=\"modal\">×<\/button>\n                    <h4 class=\"modal-title\">Add a Reply<\/h4>\n                  <\/div>\n                  <div class=\"modal-body\">\n                    \n<form class=\"\" data-target=\"reply.form\" id=\"new_comment\" action=\"/createcampaigns/206/comments\" accept-charset=\"UTF-8\" data-remote=\"true\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" />\n<div class=\"form-group\">\n<textarea class=\"form-control\" placeholder=\"Whats on your mind?\" name=\"comment[body]\" id=\"comment_body\">\n<\/textarea>\n<input value=\"184\" type=\"hidden\" name=\"comment[parent_id]\" id=\"comment_parent_id\" />\n\n<\/div>\n<input type=\"submit\" name=\"commit\" value=\"Create Comment\" class=\"btn btn-primary\" />\n\n<\/form>\n\n                  <\/div>\n                <\/div>\n              <\/div>\n            <\/div>\n                  <!-- if Reply exist, then show these by the user -->\n                  <div class=\"line-divider\"><\/div>\n                  \n                  <div class=\"panel\">\n          <div class=\"panel-heading\">\n           \n            <span class=\"panel-title\">0 Replies to Donald trump Comment<\/span>\n          <\/div>\n         \n        <\/div>\n    \n\n\n\n<!-- The Modal for all comments list-->\n<div class=\"modal\" id=\"commentModal184\">\n  <div class=\"modal-dialog\">\n    <div class=\"modal-content\">\n\n      <!-- Modal Header -->\n      <div class=\"modal-header\">\n        <h4 class=\"modal-title\">View All Messages<\/h4>\n        <button type=\"button\" class=\"close\" data-dismiss=\"modal\">&times;<\/button>\n      <\/div>\n\n      <!-- Modal body -->\n      <div class=\"modal-body\">\n           here is where the list of all comment going to be appearing\n                \n                  <div class=\"panel\">\n          <div class=\"panel-heading\">\n            <span class=\"panel-title\">0 Replies to Donald trump Comment<\/span>\n          <\/div>\n               \n\n          <a href=\"#\" class=\"widget-more-link\">MORE MESSAGES<\/a>\n        <\/div>\n      <\/div>\n\n      <!-- Modal footer -->\n      <div class=\"modal-footer\">\n        <button type=\"button\" class=\"btn btn-danger\" data-dismiss=\"modal\">Close<\/button>\n      <\/div>\n\n    <\/div>\n  <\/div>\n<\/div>    \n             \n             \n                <\/div>\n              <\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n   \n<\/div>\n\n<link href=\"https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css\" rel=\"stylesheet\">\n<div class=\"container\" id=\"comment_183\">\n    <div class=\"row\">\n        <div class=\"col-md-9\">\n            <div class=\"post-content\">\n              <div class=\"post-container\">\n                <img class=\"profile-photo-md pull-left\" src=\"https://chymeinuserupload.s3.amazonaws.com/uploads/user/image/2/man-person-suit-united-states-of-america.jpg\" alt=\"Man person suit united states of america\" />\n                <div class=\"post-detail\">\n                  <div class=\"user-info\">\n                    <h5><a href=\"timeline.html\" class=\"profile-link\">Donald trump<\/a> <span class=\"following\">following\n                          <a id=\"like_183\" class=\"glyphicon glyphicon-heart-empty\" data-remote=\"true\" href=\"/createcampaigns/183/like\"><\/a>\n                    \n                     Republican\n                    \n                    <\/span><\/h5>\n                 <p class=\"text-muted\"> Posted 11 minutes ago  <\/p>\n                  <\/div>\n                  <div class=\"reaction\">\n                    <a class=\"btn text-green\"><i class=\"fa fa-thumbs-up\"><\/i>0<br> <\/a>\n                    <a rel=\"nofollow\" data-method=\"post\" href=\"/createcampaigns/183/upvote\">Liked<\/a>\n                    <a class=\"btn text-red\"><i class=\"fa fa-thumbs-down\"><\/i> 0<\/a>\n                    <a rel=\"nofollow\" data-method=\"post\" href=\"/createcampaigns/183/downvote\">DIS-LIKE<\/a>\n                    \n                    \n                    \n                  <\/div>\n                  <div class=\"line-divider\"><\/div>\n                  <div class=\"post-text\">\n                    <p>cvc<\/p>\n                    \n                    \n                       <div class=\"text-right\">\n                       <button type=\"button\" class=\"btn btn-xl btn-primary btn-rounded\" data-toggle=\"modal\" data-target=\"#183\">\n                        ADD A REPLY\n                      <\/button>\n                      <\/div>\n                  <\/div>\n             \n                     <!-- Button trigger modal -->\n         \n\n            <!-- Modal -->\n            <div class=\"modal fade\" id=\"183\" tabindex=\"-1\">\n              <div class=\"modal-dialog modal-lg\">\n                <div class=\"modal-content\">\n                  <div class=\"modal-header\">\n                    <button type=\"button\" class=\"close\" data-dismiss=\"modal\">×<\/button>\n                    <h4 class=\"modal-title\">Add a Reply<\/h4>\n                  <\/div>\n                  <div class=\"modal-body\">\n                    \n<form class=\"\" data-target=\"reply.form\" id=\"new_comment\" action=\"/createcampaigns/206/comments\" accept-charset=\"UTF-8\" data-remote=\"true\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" />\n<div class=\"form-group\">\n<textarea class=\"form-control\" placeholder=\"Whats on your mind?\" name=\"comment[body]\" id=\"comment_body\">\n<\/textarea>\n<input value=\"183\" type=\"hidden\" name=\"comment[parent_id]\" id=\"comment_parent_id\" />\n\n<\/div>\n<input type=\"submit\" name=\"commit\" value=\"Create Comment\" class=\"btn btn-primary\" />\n\n<\/form>\n\n                  <\/div>\n                <\/div>\n              <\/div>\n            <\/div>\n                  <!-- if Reply exist, then show these by the user -->\n                  <div class=\"line-divider\"><\/div>\n                  \n                  <div class=\"panel\">\n          <div class=\"panel-heading\">\n           \n            <span class=\"panel-title\">0 Replies to Donald trump Comment<\/span>\n          <\/div>\n         \n        <\/div>\n    \n\n\n\n<!-- The Modal for all comments list-->\n<div class=\"modal\" id=\"commentModal183\">\n  <div class=\"modal-dialog\">\n    <div class=\"modal-content\">\n\n      <!-- Modal Header -->\n      <div class=\"modal-header\">\n        <h4 class=\"modal-title\">View All Messages<\/h4>\n        <button type=\"button\" class=\"close\" data-dismiss=\"modal\">&times;<\/button>\n      <\/div>\n\n      <!-- Modal body -->\n      <div class=\"modal-body\">\n           here is where the list of all comment going to be appearing\n                \n                  <div class=\"panel\">\n          <div class=\"panel-heading\">\n            <span class=\"panel-title\">0 Replies to Donald trump Comment<\/span>\n          <\/div>\n               \n\n          <a href=\"#\" class=\"widget-more-link\">MORE MESSAGES<\/a>\n        <\/div>\n      <\/div>\n\n      <!-- Modal footer -->\n      <div class=\"modal-footer\">\n        <button type=\"button\" class=\"btn btn-danger\" data-dismiss=\"modal\">Close<\/button>\n      <\/div>\n\n    <\/div>\n  <\/div>\n<\/div>    \n             \n             \n                <\/div>\n              <\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n   \n<\/div>\n\n<link href=\"https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css\" rel=\"stylesheet\">\n<div class=\"container\" id=\"comment_182\">\n    <div class=\"row\">\n        <div class=\"col-md-9\">\n            <div class=\"post-content\">\n              <div class=\"post-container\">\n                <img class=\"profile-photo-md pull-left\" src=\"https://chymeinuserupload.s3.amazonaws.com/uploads/user/image/2/man-person-suit-united-states-of-america.jpg\" alt=\"Man person suit united states of america\" />\n                <div class=\"post-detail\">\n                  <div class=\"user-info\">\n                    <h5><a href=\"timeline.html\" class=\"profile-link\">Donald trump<\/a> <span class=\"following\">following\n                          <a id=\"like_182\" class=\"glyphicon glyphicon-heart-empty\" data-remote=\"true\" href=\"/createcampaigns/182/like\"><\/a>\n                    \n                     Republican\n                    \n                    <\/span><\/h5>\n                 <p class=\"text-muted\"> Posted 15 minutes ago  <\/p>\n                  <\/div>\n                  <div class=\"reaction\">\n                    <a class=\"btn text-green\"><i class=\"fa fa-thumbs-up\"><\/i>0<br> <\/a>\n                    <a rel=\"nofollow\" data-method=\"post\" href=\"/createcampaigns/182/upvote\">Liked<\/a>\n                    <a class=\"btn text-red\"><i class=\"fa fa-thumbs-down\"><\/i> 0<\/a>\n                    <a rel=\"nofollow\" data-method=\"post\" href=\"/createcampaigns/182/downvote\">DIS-LIKE<\/a>\n                    \n                    \n                    \n                  <\/div>\n                  <div class=\"line-divider\"><\/div>\n                  <div class=\"post-text\">\n                    <p>cvc<\/p>\n                    \n                    \n                       <div class=\"text-right\">\n                       <button type=\"button\" class=\"btn btn-xl btn-primary btn-rounded\" data-toggle=\"modal\" data-target=\"#182\">\n                        ADD A REPLY\n                      <\/button>\n                      <\/div>\n                  <\/div>\n             \n                     <!-- Button trigger modal -->\n         \n\n            <!-- Modal -->\n            <div class=\"modal fade\" id=\"182\" tabindex=\"-1\">\n              <div class=\"modal-dialog modal-lg\">\n                <div class=\"modal-content\">\n                  <div class=\"modal-header\">\n                    <button type=\"button\" class=\"close\" data-dismiss=\"modal\">×<\/button>\n                    <h4 class=\"modal-title\">Add a Reply<\/h4>\n                  <\/div>\n                  <div class=\"modal-body\">\n                    \n<form class=\"\" data-target=\"reply.form\" id=\"new_comment\" action=\"/createcampaigns/206/comments\" accept-charset=\"UTF-8\" data-remote=\"true\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" />\n<div class=\"form-group\">\n<textarea class=\"form-control\" placeholder=\"Whats on your mind?\" name=\"comment[body]\" id=\"comment_body\">\n<\/textarea>\n<input value=\"182\" type=\"hidden\" name=\"comment[parent_id]\" id=\"comment_parent_id\" />\n\n<\/div>\n<input type=\"submit\" name=\"commit\" value=\"Create Comment\" class=\"btn btn-primary\" />\n\n<\/form>\n\n                  <\/div>\n                <\/div>\n              <\/div>\n            <\/div>\n                  <!-- if Reply exist, then show these by the user -->\n                  <div class=\"line-divider\"><\/div>\n                  \n                  <div class=\"panel\">\n          <div class=\"panel-heading\">\n           \n            <span class=\"panel-title\">0 Replies to Donald trump Comment<\/span>\n          <\/div>\n         \n        <\/div>\n    \n\n\n\n<!-- The Modal for all comments list-->\n<div class=\"modal\" id=\"commentModal182\">\n  <div class=\"modal-dialog\">\n    <div class=\"modal-content\">\n\n      <!-- Modal Header -->\n      <div class=\"modal-header\">\n        <h4 class=\"modal-title\">View All Messages<\/h4>\n        <button type=\"button\" class=\"close\" data-dismiss=\"modal\">&times;<\/button>\n      <\/div>\n\n      <!-- Modal body -->\n      <div class=\"modal-body\">\n           here is where the list of all comment going to be appearing\n                \n                  <div class=\"panel\">\n          <div class=\"panel-heading\">\n            <span class=\"panel-title\">0 Replies to Donald trump Comment<\/span>\n          <\/div>\n               \n\n          <a href=\"#\" class=\"widget-more-link\">MORE MESSAGES<\/a>\n        <\/div>\n      <\/div>\n\n      <!-- Modal footer -->\n      <div class=\"modal-footer\">\n        <button type=\"button\" class=\"btn btn-danger\" data-dismiss=\"modal\">Close<\/button>\n      <\/div>\n\n    <\/div>\n  <\/div>\n<\/div>    \n             \n             \n                <\/div>\n              <\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n   \n<\/div>\n\n<link href=\"https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css\" rel=\"stylesheet\">\n<div class=\"container\" id=\"comment_181\">\n    <div class=\"row\">\n        <div class=\"col-md-9\">\n            <div class=\"post-content\">\n              <div class=\"post-container\">\n                <img class=\"profile-photo-md pull-left\" src=\"https://chymeinuserupload.s3.amazonaws.com/uploads/user/image/2/man-person-suit-united-states-of-america.jpg\" alt=\"Man person suit united states of america\" />\n                <div class=\"post-detail\">\n                  <div class=\"user-info\">\n                    <h5><a href=\"timeline.html\" class=\"profile-link\">Donald trump<\/a> <span class=\"following\">following\n                          <a id=\"like_181\" class=\"glyphicon glyphicon-heart-empty\" data-remote=\"true\" href=\"/createcampaigns/181/like\"><\/a>\n                    \n                     Republican\n                    \n                    <\/span><\/h5>\n                 <p class=\"text-muted\"> Posted 25 minutes ago  <\/p>\n                  <\/div>\n                  <div class=\"reaction\">\n                    <a class=\"btn text-green\"><i class=\"fa fa-thumbs-up\"><\/i>0<br> <\/a>\n                    <a rel=\"nofollow\" data-method=\"post\" href=\"/createcampaigns/181/upvote\">Liked<\/a>\n                    <a class=\"btn text-red\"><i class=\"fa fa-thumbs-down\"><\/i> 0<\/a>\n                    <a rel=\"nofollow\" data-method=\"post\" href=\"/createcampaigns/181/downvote\">DIS-LIKE<\/a>\n                    \n                    \n                    \n                  <\/div>\n                  <div class=\"line-divider\"><\/div>\n                  <div class=\"post-text\">\n                    <p>,L,KKKK<\/p>\n                    \n                    \n                       <div class=\"text-right\">\n                       <button type=\"button\" class=\"btn btn-xl btn-primary btn-rounded\" data-toggle=\"modal\" data-target=\"#181\">\n                        ADD A REPLY\n                      <\/button>\n                      <\/div>\n                  <\/div>\n             \n                     <!-- Button trigger modal -->\n         \n\n            <!-- Modal -->\n            <div class=\"modal fade\" id=\"181\" tabindex=\"-1\">\n              <div class=\"modal-dialog modal-lg\">\n                <div class=\"modal-content\">\n                  <div class=\"modal-header\">\n                    <button type=\"button\" class=\"close\" data-dismiss=\"modal\">×<\/button>\n                    <h4 class=\"modal-title\">Add a Reply<\/h4>\n                  <\/div>\n                  <div class=\"modal-body\">\n                    \n<form class=\"\" data-target=\"reply.form\" id=\"new_comment\" action=\"/createcampaigns/206/comments\" accept-charset=\"UTF-8\" data-remote=\"true\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" />\n<div class=\"form-group\">\n<textarea class=\"form-control\" placeholder=\"Whats on your mind?\" name=\"comment[body]\" id=\"comment_body\">\n<\/textarea>\n<input value=\"181\" type=\"hidden\" name=\"comment[parent_id]\" id=\"comment_parent_id\" />\n\n<\/div>\n<input type=\"submit\" name=\"commit\" value=\"Create Comment\" class=\"btn btn-primary\" />\n\n<\/form>\n\n                  <\/div>\n                <\/div>\n              <\/div>\n            <\/div>\n                  <!-- if Reply exist, then show these by the user -->\n                  <div class=\"line-divider\"><\/div>\n                  \n                  <div class=\"panel\">\n          <div class=\"panel-heading\">\n           \n            <span class=\"panel-title\">0 Replies to Donald trump Comment<\/span>\n          <\/div>\n         \n        <\/div>\n    \n\n\n\n<!-- The Modal for all comments list-->\n<div class=\"modal\" id=\"commentModal181\">\n  <div class=\"modal-dialog\">\n    <div class=\"modal-content\">\n\n      <!-- Modal Header -->\n      <div class=\"modal-header\">\n        <h4 class=\"modal-title\">View All Messages<\/h4>\n        <button type=\"button\" class=\"close\" data-dismiss=\"modal\">&times;<\/button>\n      <\/div>\n\n      <!-- Modal body -->\n      <div class=\"modal-body\">\n           here is where the list of all comment going to be appearing\n                \n                  <div class=\"panel\">\n          <div class=\"panel-heading\">\n            <span class=\"panel-title\">0 Replies to Donald trump Comment<\/span>\n          <\/div>\n               \n\n          <a href=\"#\" class=\"widget-more-link\">MORE MESSAGES<\/a>\n        <\/div>\n      <\/div>\n\n      <!-- Modal footer -->\n      <div class=\"modal-footer\">\n        <button type=\"button\" class=\"btn btn-danger\" data-dismiss=\"modal\">Close<\/button>\n      <\/div>\n\n    <\/div>\n  <\/div>\n<\/div>    \n             \n             \n                <\/div>\n              <\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n   \n<\/div>\n\n<link href=\"https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css\" rel=\"stylesheet\">\n<div class=\"container\" id=\"comment_180\">\n    <div class=\"row\">\n        <div class=\"col-md-9\">\n            <div class=\"post-content\">\n              <div class=\"post-container\">\n                <img class=\"profile-photo-md pull-left\" src=\"https://chymeinuserupload.s3.amazonaws.com/uploads/user/image/2/man-person-suit-united-states-of-america.jpg\" alt=\"Man person suit united states of america\" />\n                <div class=\"post-detail\">\n                  <div class=\"user-info\">\n                    <h5><a href=\"timeline.html\" class=\"profile-link\">Donald trump<\/a> <span class=\"following\">following\n                          <a id=\"like_180\" class=\"glyphicon glyphicon-heart-empty\" data-remote=\"true\" href=\"/createcampaigns/180/like\"><\/a>\n                    \n                     Republican\n                    \n                    <\/span><\/h5>\n                 <p class=\"text-muted\"> Posted 25 minutes ago  <\/p>\n                  <\/div>\n                  <div class=\"reaction\">\n                    <a class=\"btn text-green\"><i class=\"fa fa-thumbs-up\"><\/i>0<br> <\/a>\n                    <a rel=\"nofollow\" data-method=\"post\" href=\"/createcampaigns/180/upvote\">Liked<\/a>\n                    <a class=\"btn text-red\"><i class=\"fa fa-thumbs-down\"><\/i> 0<\/a>\n                    <a rel=\"nofollow\" data-method=\"post\" href=\"/createcampaigns/180/downvote\">DIS-LIKE<\/a>\n                    \n                    \n                    \n                  <\/div>\n                  <div class=\"line-divider\"><\/div>\n                  <div class=\"post-text\">\n                    <p>,L,<\/p>\n                    \n                    \n                       <div class=\"text-right\">\n                       <button type=\"button\" class=\"btn btn-xl btn-primary btn-rounded\" data-toggle=\"modal\" data-target=\"#180\">\n                        ADD A REPLY\n                      <\/button>\n                      <\/div>\n                  <\/div>\n             \n                     <!-- Button trigger modal -->\n         \n\n            <!-- Modal -->\n            <div class=\"modal fade\" id=\"180\" tabindex=\"-1\">\n              <div class=\"modal-dialog modal-lg\">\n                <div class=\"modal-content\">\n                  <div class=\"modal-header\">\n                    <button type=\"button\" class=\"close\" data-dismiss=\"modal\">×<\/button>\n                    <h4 class=\"modal-title\">Add a Reply<\/h4>\n                  <\/div>\n                  <div class=\"modal-body\">\n                    \n<form class=\"\" data-target=\"reply.form\" id=\"new_comment\" action=\"/createcampaigns/206/comments\" accept-charset=\"UTF-8\" data-remote=\"true\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" />\n<div class=\"form-group\">\n<textarea class=\"form-control\" placeholder=\"Whats on your mind?\" name=\"comment[body]\" id=\"comment_body\">\n<\/textarea>\n<input value=\"180\" type=\"hidden\" name=\"comment[parent_id]\" id=\"comment_parent_id\" />\n\n<\/div>\n<input type=\"submit\" name=\"commit\" value=\"Create Comment\" class=\"btn btn-primary\" />\n\n<\/form>\n\n                  <\/div>\n                <\/div>\n              <\/div>\n            <\/div>\n                  <!-- if Reply exist, then show these by the user -->\n                  <div class=\"line-divider\"><\/div>\n                  \n                  <div class=\"panel\">\n          <div class=\"panel-heading\">\n           \n            <span class=\"panel-title\">0 Replies to Donald trump Comment<\/span>\n          <\/div>\n         \n        <\/div>\n    \n\n\n\n<!-- The Modal for all comments list-->\n<div class=\"modal\" id=\"commentModal180\">\n  <div class=\"modal-dialog\">\n    <div class=\"modal-content\">\n\n      <!-- Modal Header -->\n      <div class=\"modal-header\">\n        <h4 class=\"modal-title\">View All Messages<\/h4>\n        <button type=\"button\" class=\"close\" data-dismiss=\"modal\">&times;<\/button>\n      <\/div>\n\n      <!-- Modal body -->\n      <div class=\"modal-body\">\n           here is where the list of all comment going to be appearing\n                \n                  <div class=\"panel\">\n          <div class=\"panel-heading\">\n            <span class=\"panel-title\">0 Replies to Donald trump Comment<\/span>\n          <\/div>\n               \n\n          <a href=\"#\" class=\"widget-more-link\">MORE MESSAGES<\/a>\n        <\/div>\n      <\/div>\n\n      <!-- Modal footer -->\n      <div class=\"modal-footer\">\n        <button type=\"button\" class=\"btn btn-danger\" data-dismiss=\"modal\">Close<\/button>\n      <\/div>\n\n    <\/div>\n  <\/div>\n<\/div>    \n             \n             \n                <\/div>\n              <\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n   \n<\/div>\n\n<link href=\"https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css\" rel=\"stylesheet\">\n<div class=\"container\" id=\"comment_179\">\n    <div class=\"row\">\n        <div class=\"col-md-9\">\n            <div class=\"post-content\">\n              <div class=\"post-container\">\n                <img class=\"profile-photo-md pull-left\" src=\"https://chymeinuserupload.s3.amazonaws.com/uploads/user/image/2/man-person-suit-united-states-of-america.jpg\" alt=\"Man person suit united states of america\" />\n                <div class=\"post-detail\">\n                  <div class=\"user-info\">\n                    <h5><a href=\"timeline.html\" class=\"profile-link\">Donald trump<\/a> <span class=\"following\">following\n                          <a id=\"like_179\" class=\"glyphicon glyphicon-heart-empty\" data-remote=\"true\" href=\"/createcampaigns/179/like\"><\/a>\n                    \n                     Republican\n                    \n                    <\/span><\/h5>\n                 <p class=\"text-muted\"> Posted 26 minutes ago  <\/p>\n                  <\/div>\n                  <div class=\"reaction\">\n                    <a class=\"btn text-green\"><i class=\"fa fa-thumbs-up\"><\/i>0<br> <\/a>\n                    <a rel=\"nofollow\" data-method=\"post\" href=\"/createcampaigns/179/upvote\">Liked<\/a>\n                    <a class=\"btn text-red\"><i class=\"fa fa-thumbs-down\"><\/i> 0<\/a>\n                    <a rel=\"nofollow\" data-method=\"post\" href=\"/createcampaigns/179/downvote\">DIS-LIKE<\/a>\n                    \n                    \n                    \n                  <\/div>\n                  <div class=\"line-divider\"><\/div>\n                  <div class=\"post-text\">\n                    <p>NFGHFG<\/p>\n                    \n                    \n                       <div class=\"text-right\">\n                       <button type=\"button\" class=\"btn btn-xl btn-primary btn-rounded\" data-toggle=\"modal\" data-target=\"#179\">\n                        ADD A REPLY\n                      <\/button>\n                      <\/div>\n                  <\/div>\n             \n                     <!-- Button trigger modal -->\n         \n\n            <!-- Modal -->\n            <div class=\"modal fade\" id=\"179\" tabindex=\"-1\">\n              <div class=\"modal-dialog modal-lg\">\n                <div class=\"modal-content\">\n                  <div class=\"modal-header\">\n                    <button type=\"button\" class=\"close\" data-dismiss=\"modal\">×<\/button>\n                    <h4 class=\"modal-title\">Add a Reply<\/h4>\n                  <\/div>\n                  <div class=\"modal-body\">\n                    \n<form class=\"\" data-target=\"reply.form\" id=\"new_comment\" action=\"/createcampaigns/206/comments\" accept-charset=\"UTF-8\" data-remote=\"true\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" />\n<div class=\"form-group\">\n<textarea class=\"form-control\" placeholder=\"Whats on your mind?\" name=\"comment[body]\" id=\"comment_body\">\n<\/textarea>\n<input value=\"179\" type=\"hidden\" name=\"comment[parent_id]\" id=\"comment_parent_id\" />\n\n<\/div>\n<input type=\"submit\" name=\"commit\" value=\"Create Comment\" class=\"btn btn-primary\" />\n\n<\/form>\n\n                  <\/div>\n                <\/div>\n              <\/div>\n            <\/div>\n                  <!-- if Reply exist, then show these by the user -->\n                  <div class=\"line-divider\"><\/div>\n                  \n                  <div class=\"panel\">\n          <div class=\"panel-heading\">\n           \n            <span class=\"panel-title\">0 Replies to Donald trump Comment<\/span>\n          <\/div>\n         \n        <\/div>\n    \n\n\n\n<!-- The Modal for all comments list-->\n<div class=\"modal\" id=\"commentModal179\">\n  <div class=\"modal-dialog\">\n    <div class=\"modal-content\">\n\n      <!-- Modal Header -->\n      <div class=\"modal-header\">\n        <h4 class=\"modal-title\">View All Messages<\/h4>\n        <button type=\"button\" class=\"close\" data-dismiss=\"modal\">&times;<\/button>\n      <\/div>\n\n      <!-- Modal body -->\n      <div class=\"modal-body\">\n           here is where the list of all comment going to be appearing\n                \n                  <div class=\"panel\">\n          <div class=\"panel-heading\">\n            <span class=\"panel-title\">0 Replies to Donald trump Comment<\/span>\n          <\/div>\n               \n\n          <a href=\"#\" class=\"widget-more-link\">MORE MESSAGES<\/a>\n        <\/div>\n      <\/div>\n\n      <!-- Modal footer -->\n      <div class=\"modal-footer\">\n        <button type=\"button\" class=\"btn btn-danger\" data-dismiss=\"modal\">Close<\/button>\n      <\/div>\n\n    <\/div>\n  <\/div>\n<\/div>    \n             \n             \n                <\/div>\n              <\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n   \n<\/div>\n\n<link href=\"https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css\" rel=\"stylesheet\">\n<div class=\"container\" id=\"comment_178\">\n    <div class=\"row\">\n        <div class=\"col-md-9\">\n            <div class=\"post-content\">\n              <div class=\"post-container\">\n                <img class=\"profile-photo-md pull-left\" src=\"https://chymeinuserupload.s3.amazonaws.com/uploads/user/image/2/man-person-suit-united-states-of-america.jpg\" alt=\"Man person suit united states of america\" />\n                <div class=\"post-detail\">\n                  <div class=\"user-info\">\n                    <h5><a href=\"timeline.html\" class=\"profile-link\">Donald trump<\/a> <span class=\"following\">following\n                          <a id=\"like_178\" class=\"glyphicon glyphicon-heart-empty\" data-remote=\"true\" href=\"/createcampaigns/178/like\"><\/a>\n                    \n                     Republican\n                    \n                    <\/span><\/h5>\n                 <p class=\"text-muted\"> Posted 30 minutes ago  <\/p>\n                  <\/div>\n                  <div class=\"reaction\">\n                    <a class=\"btn text-green\"><i class=\"fa fa-thumbs-up\"><\/i>1<br> <\/a>\n                    <a rel=\"nofollow\" data-method=\"post\" href=\"/createcampaigns/178/upvote\">Liked<\/a>\n                    <a class=\"btn text-red\"><i class=\"fa fa-thumbs-down\"><\/i> 1<\/a>\n                    <a rel=\"nofollow\" data-method=\"post\" href=\"/createcampaigns/178/downvote\">DIS-LIKE<\/a>\n                    \n                    \n                    \n                  <\/div>\n                  <div class=\"line-divider\"><\/div>\n                  <div class=\"post-text\">\n                    <p>lice offer need to stop beating people up Readmore<\/p>\n                    \n                    \n                       <div class=\"text-right\">\n                       <button type=\"button\" class=\"btn btn-xl btn-primary btn-rounded\" data-toggle=\"modal\" data-target=\"#178\">\n                        ADD A REPLY\n                      <\/button>\n                      <\/div>\n                  <\/div>\n             \n                     <!-- Button trigger modal -->\n         \n\n            <!-- Modal -->\n            <div class=\"modal fade\" id=\"178\" tabindex=\"-1\">\n              <div class=\"modal-dialog modal-lg\">\n                <div class=\"modal-content\">\n                  <div class=\"modal-header\">\n                    <button type=\"button\" class=\"close\" data-dismiss=\"modal\">×<\/button>\n                    <h4 class=\"modal-title\">Add a Reply<\/h4>\n                  <\/div>\n                  <div class=\"modal-body\">\n                    \n<form class=\"\" data-target=\"reply.form\" id=\"new_comment\" action=\"/createcampaigns/206/comments\" accept-charset=\"UTF-8\" data-remote=\"true\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" />\n<div class=\"form-group\">\n<textarea class=\"form-control\" placeholder=\"Whats on your mind?\" name=\"comment[body]\" id=\"comment_body\">\n<\/textarea>\n<input value=\"178\" type=\"hidden\" name=\"comment[parent_id]\" id=\"comment_parent_id\" />\n\n<\/div>\n<input type=\"submit\" name=\"commit\" value=\"Create Comment\" class=\"btn btn-primary\" />\n\n<\/form>\n\n                  <\/div>\n                <\/div>\n              <\/div>\n            <\/div>\n                  <!-- if Reply exist, then show these by the user -->\n                  <div class=\"line-divider\"><\/div>\n                  \n                  <div class=\"panel\">\n          <div class=\"panel-heading\">\n           \n            <span class=\"panel-title\">0 Replies to Donald trump Comment<\/span>\n          <\/div>\n         \n        <\/div>\n    \n\n\n\n<!-- The Modal for all comments list-->\n<div class=\"modal\" id=\"commentModal178\">\n  <div class=\"modal-dialog\">\n    <div class=\"modal-content\">\n\n      <!-- Modal Header -->\n      <div class=\"modal-header\">\n        <h4 class=\"modal-title\">View All Messages<\/h4>\n        <button type=\"button\" class=\"close\" data-dismiss=\"modal\">&times;<\/button>\n      <\/div>\n\n      <!-- Modal body -->\n      <div class=\"modal-body\">\n           here is where the list of all comment going to be appearing\n                \n                  <div class=\"panel\">\n          <div class=\"panel-heading\">\n            <span class=\"panel-title\">0 Replies to Donald trump Comment<\/span>\n          <\/div>\n               \n\n          <a href=\"#\" class=\"widget-more-link\">MORE MESSAGES<\/a>\n        <\/div>\n      <\/div>\n\n      <!-- Modal footer -->\n      <div class=\"modal-footer\">\n        <button type=\"button\" class=\"btn btn-danger\" data-dismiss=\"modal\">Close<\/button>\n      <\/div>\n\n    <\/div>\n  <\/div>\n<\/div>    \n             \n             \n                <\/div>\n              <\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n   \n<\/div>\n\n\n        <\/div>");

$('#comment_content_190').val('')

Posted in Nested Comment Threads in Rails - Part 1 Discussion

Chris for some reason, i can't get stimulus Reply effect to work.... I am able to hide the reply but clicking on it does not do anything .. it does not expand or collapse

This seems to work for me "visibility: hidden" instead of d-none

but when i click reply, that does not work. i stimulus js dont seem to work for me. any debugging tips?

Posted in Nested Comment Threads in Rails - Part 1 Discussion

chris can we also cover auto scrolling when comment meets at end of page, if it has more comments that it will load as user scrolls? maybe on the main page or do it on a pop up when a user clocks view more comments it pops up and then they can see all the comments and as they reach bottom if there is more comment it scrolls?

Posted in Nested Comment Threads in Rails - Part 1 Discussion

Thank you chris for the consideration!!! that why i re-joined:) when you cather to all your user needs, you build a loyal group of people... Thank i am looking forward for the episode... you know when that will be? :) excited!!!

Posted in Nested Comment Threads in Rails - Part 1 Discussion

any help on this topic will be helpful

Posted in Nested Comment Threads in Rails - Part 1 Discussion

Chris as part of the next part2 series, please add the ability to dynamically update without refreshing the page.... Best practice. As i am able to use the reply system, but i hate how the page has to refresh and i have been struggling to have it appear directly on the page without refreshing... That will be helpful!!

Posted in How do i implement load more comments or reply

wow no comment or reply .... go much for membership:)

Posted in How do i implement load more comments or reply

Chris i followed your series on implementing commenting systeming using polymorphic is true. Now that i got that implemented. i want to know how do i make this work with will paginate for example....

so in my SHOW.html.erb file i render the partial
<%= render partial: "comments/form", locals: {commentable: @campaign}, class:"form-control" %>
<%= render partial: "comments/comments", locals: {commentable: @campaign} %>

                i would like to limit the number of reply returned and allow the user to paginate to the next say 5 comments etc.... how do i do that? can you give a complete example code ..... remember i use your series of polymorphic true series, so build it from that perspective... response as soon as you can will be apprecited

All i am trying to create follow and follwers relationship and i am experiencing some issues. Chris i think you should create a course on this as well. i am getting issue undefined method `id' for nil:NilClass

Secondly i created a follow button class and that not being displayed on the page when i render it

Relationship.rb

class Relationship < ActiveRecord::Base

  belongs_to :follower, class_name: "User"
  belongs_to :followed, class_name: "User"

  validates :follower_id, :presence => true
  validates :followed_id, :presence => true

  validate :validate_followers

  def validate_followers
    errors.add(:follower_id, "You cannot follow yourself") if follower_id == followed_id
  end
end

User.rb

class User < ActiveRecord::Base
 mount_uploader :avatar, AvatarUploader
  mount_uploader :campaignimage, ImageUploader

  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable
acts_as_follower
acts_as_followable

         # User Avatar Validation
  validates_integrity_of  :avatar
  validates_processing_of :avatar
 validates_integrity_of  :campaignimage
  validates_processing_of :campaignimage
   validates :first_name,:last_name,  presence: true  



    has_many :createcampaigns, dependent: :destroy
    has_many :relationships, foreign_key: "follower_id", dependent: :destroy
    has_many :squeals, dependent: :destroy
    has_many :tweets
    has_many :comments, as: :commentable
    has_many:reviews, dependent: :destroy
    has_many:createcampaign, dependent: :destroy
    has_many :posts, dependent: :destroy

     has_many :posts, dependent: :destroy # remove a user's posts if his account is deleted.
         has_many :active_relationships, class_name: "Relationship", foreign_key: "follower_id", dependent: :destroy
         has_many :passive_relationships, class_name: "Relationship", foreign_key: "followed_id", dependent: :destroy

         has_many :following, through: :active_relationships, source: :followed
         has_many :followers, through: :passive_relationships, source: :follower





     # follow another user
         def follow(other)
           active_relationships.create(followed_id: other.id)
         end

         # unfollow a user
         def unfollow(other)
           active_relationships.find_by(followed_id: other.id).destroy
         end

         # is following a user?
         def following?(other)
           following.include?(other)
         end



   private
    def avatar_size_validation
      errors[:avatar] << "should be less than 500KB" if avatar.size > 0.5.megabytes
    end

end

Users.rb

devise_for :users 
  resources :users do

    member do
     get :following, :followers
    end
    resources :createcampaigns
  resources :comments,module: :user
  end

user controller

class UsersController < ApplicationController
 before_action :authenticate_user,
                only: [:index, :edit, :update, :destroy, :following, :followers]

  def show

    if (User.find_by_username(params[:id]))
      @username = params[:id]

    else 
      # redirect to 404 (root for now)
      redirect_to root_path, :notice=> "User not found!" 
    end
    @user = User.find_by_username(params[:username])

     #@user = current_user
    @username= User.find_by_username(params[:username])
    @currentuser = current_user
     @allcampaign = Createcampaign.all
      @toFollow = User.all.last(5)
  end


  def index
  end



  def new
  @user = User.new

end


 def following
    @title = "Following"
    @user = User.find(params[:id])
    @users = @user.followed_users.paginate(page: params[:page])
    render 'show_follow'
  end

  def followers
    @title = "Followers"
    @user = User.find(params[:id])
    @users = @user.followers.paginate(page: params[:page])
    render 'show_follow'
  end


end 

_follow_form


  <div id="follow_form">
  <% if current_user.following?(@user) %>
    <%= render 'unfollow' %>
  <% else %>
    <%= render 'follow' %>
  <% end %>
  </div>

when i click on follow: i get the following

undefined method `id' for nil:NilClass

Extracted source (around line #43):
41
42
43
44
45
46

 # follow another user
     def follow(other)
       active_relationships.create(followed_id: other.id)
     end

     # unfollow a user


             Another class is not being displayed when i render it in the page

             <% if current_user.username != @user.username %>
where is it

            <% if !current_user.following?(@user) %>
                <%= form_for(current_user.active_relationships.build) do |f| %>
                    <div><%= hidden_field_tag :followed_id, user.id %></div>
                    <%= f.submit "Follow", class: "btn btn-primary" %>
                <% end %>
            <% else %>
                <%= form_for(current_user.active_relationships.find_by(followed_id: user.id),
                    html: { method: :delete }) do |f| %>
                    <%= f.submit "Unfollow", class: "btn" %>
                <% end %>
            <% end %>

<% end %>

Posted in how do i link a comment to a specific post...

Thank you Jack..

Here is the Problem, when i click on Submit for a comment, i get uninitialized constants Squeals.

on my Squeal/Show.html.erb file where i show a specific or selected post
Url: https://squealing-app-squeldev.c9users.io/squeals/6
i enter my comments and clink on submit and then i am taking to URL https://squealing-app-squeldev.c9users.io/squeals/6/comments
With Error
uninitialized constant Squeals
Rails.root: /home/ubuntu/workspace
Application Trace | Framework Trace | Full Trace
Routes
SHOW.HTML.ERB FILE

<p id="notice"><%= notice %></p>

<p>
  <strong>Title:</strong>
  <%= @squeal.title %>
  <%=%>
</p>

<p>
  <strong>Body:</strong>
  <%= @squeal.body %>
</p>

<%= link_to 'Edit', edit_squeal_path(@squeal) %> |
<%= link_to 'Back', squeals_path %>



<div class="row">
  <div class="col-md-6 col-md-offset-3">
    <div class="well">
       <%= render partial:"comments/comments",locals:{commentable:@squeal} %>
       <%= render partial:"comments/form",locals:{commentable:@squeal} %>
      <h2>Comments</h2>

      <% @squeal.comments.each do |comment|%>

          <%=comment.body%>

      <%end%>

  </div>
</div>


Comments controller

class CommentsController < ApplicationController
    before_action:authenticate_user!

    def create
    @comment = @commentable.comments.new comment_params
    @user.user = current_user
    comment.save
    redirect_to @commentable, notice: "Your comment was posted"
    end

    private
    def comment_params
        params.require(:comment).permit(:body)
    end
end

file: squeal/comments_controller

class Squeals::CommentsController <CommentsController
before_action :set_commentable

private
def set_commentable

    @commentable = Squeal.find(params[:squeal_id])
end

end

Hi Thank you, i followed this tutorial however i am getting
Routing Error when i click submit for the comment...

uninitialized constant Squeals

Rails.root: /home/ubuntu/workspace

Application Trace | Framework Trace | Full Trace

here is my routes.rb:

Rails.application.routes.draw do

  resources :commentonsqueals
  resources :squeals do
    resources :comments, module: :squeals

end

  get 'squeals/index'
   resources :campaign
  devise_for :users
  resources :users do
    get "users/show_image" => "users#show_image"
    member do
      get :following, :followers
    end
  end
  resources :relationships, only: [:create, :destroy]
  resources :posts, only:[:create,:destroy]
  # Define Root URL
  root 'pages#index'

  # Define Routes for Pages
  get '/home' => 'pages#home' # override default routes.
  get '/user/:id' => 'pages#profile'
  get '/explore' => 'pages#explore'
 put 'posts/:id', to: 'posts#update'
get 'posts/:id/edit', to: 'posts#edit', as: :edit_post
get '/signup' => 'pages#signup'
  get '/show' => 'pages#show'
    get 'show/:id' => 'pages#show'

   get '/campaign' => 'campaign#index'
    get 'dashboard'=>'pages#dashboard'

squeal RB file

```
class Squeal < ActiveRecord::Base
has_many :comments, as: :commentable

end


COMMENTS.RB FILE

class Comment < ActiveRecord::Base
belongs_to:commentable, polymorphic:true
end


Comments-> Comments.html.erb
Comments-> _form.html.erb

squeal->comments_controller

class Squeals::CommentsController <CommentsController
before_action :set_commentable

private
def set_commentable

@commentable = Squeal.find(params[:id])

end

end


**comments controller**

class CommentsController < ApplicationController
before_action:authenticate_user!

def create
@comment = @commentable.comments.new comment_params
@user.user = current_user
comment.save
redirect_to @commentable, notice: "Your comment was posted"
end

private
def comment_params
    params.require(:comment).permit(:body)
end

end


SQEALS-> show.html.erb

<%= notice %>

Title: <%= @squeal.title %> <%=%>

Body: <%= @squeal.body %>

<%= link_to 'Edit', edit_squeal_path(@squeal) %> |
<%= link_to 'Back', squeals_path %>

<%= render partial:"comments/comments",locals:{commentable:@squeal} %> <%= render partial:"comments/form",locals:{commentable:@squeal} %>

Comments

<% @squeal.comments.each do |comment|%> <%=comment.body%> <%end%>

_form.html.erb

<%= form_for(@squeal) do |f| %>

<% if @squeal.errors.any? %>


<%= pluralize(@squeal.errors.count, "error") %> prohibited this squeal from being saved:

  <ul>
  <% @squeal.errors.full_messages.each do |message| %>
    <li><%= message %></li>
  <% end %>
  </ul>
</div>

<% end %>


<%= f.label :title %>

<%= f.text_field :title %>


<%= f.label :body %>

<%= f.text_area :body %>


<%= f.submit %>

<% end %>

Posted in how do i link a comment to a specific post...

Hi Thank you, i followed this tutorial however i am getting
Routing Error
uninitialized constant Squeals

Rails.root: /home/ubuntu/workspace

Application Trace | Framework Trace | Full Trace

here is my routes.rb:
Rails.application.routes.draw do

resources :commentonsqueals
resources :squeals do
resources :comments, module: :squeals

end

get 'squeals/index'
resources :campaign
devise_for :users
resources :users do
get "users/show_image" => "users#show_image"
member do
get :following, :followers
end
end
resources :relationships, only: [:create, :destroy]
resources :posts, only:[:create,:destroy]
# Define Root URL
root 'pages#index'

# Define Routes for Pages
get '/home' => 'pages#home' # override default routes.
get '/user/:id' => 'pages#profile'
get '/explore' => 'pages#explore'
put 'posts/:id', to: 'posts#update'
get 'posts/:id/edit', to: 'posts#edit', as: :edit_post
get '/signup' => 'pages#signup'
get '/show' => 'pages#show'
get 'show/:id' => 'pages#show'

get '/campaign' => 'campaign#index'
get 'dashboard'=>'pages#dashboard'

squeal RB file

class Squeal < ActiveRecord::Base
has_many :comments, as: :commentable

end

COMMENTS.RB FILE

class Comment < ActiveRecord::Base
belongs_to:commentable, polymorphic:true
end

Comments-> Comments.html.erb
Comments-> _form.html.erb

squeal->comments_controller
class Squeals::CommentsController <CommentsController
before_action :set_commentable

private
def set_commentable

@commentable = Squeal.find(params[:id])

end

end

*comments controller
*

class CommentsController < ApplicationController
before_action:authenticate_user!

def create
@comment = @commentable.comments.new comment_params
@user.user = current_user
comment.save
redirect_to @commentable, notice: "Your comment was posted"
end

private
def comment_params
    params.require(:comment).permit(:body)
end

end

SQEALS-> show.html.erb

<%= notice %>

Title: <%= @squeal.title %> <%=%>

Body: <%= @squeal.body %>

<%= link_to 'Edit', edit_squeal_path(@squeal) %> |
<%= link_to 'Back', squeals_path %>

<%= render partial:"comments/comments",locals:{commentable:@squeal} %> <%= render partial:"comments/form",locals:{commentable:@squeal} %>

Comments

<% @squeal.comments.each do |comment|%> <%=comment.body%> <%end%>

_form.html.erb

<%= form_for(@squeal) do |f| %>

<% if @squeal.errors.any? %>


<%= pluralize(@squeal.errors.count, "error") %> prohibited this squeal from being saved:

  <ul>
  <% @squeal.errors.full_messages.each do |message| %>
    <li><%= message %></li>
  <% end %>
  </ul>
</div>

<% end %>


<%= f.label :title %>

<%= f.text_field :title %>


<%= f.label :body %>

<%= f.text_area :body %>


<%= f.submit %>

<% end %>

Posted in how do i link a comment to a specific post...

Can someone give me an example of POST and Comment.. i did a scaffold of a blog for example but i am not sure how to integrate the part where you can link a comment to a specific post....

COMMENTS controller
class CommentonsquealsController < ApplicationController
before_action :set_commentonsqueal, only: [:show, :edit, :update, :destroy]

# GET /commentonsqueals
# GET /commentonsqueals.json
def index
@commentonsqueals = Commentonsqueal.all
@squeal = Squeal.all
end

# GET /commentonsqueals/1
# GET /commentonsqueals/1.json
def show
end

# GET /commentonsqueals/new
def new
@commentonsqueal = Commentonsqueal.new(Squeal.find_by_id(params[:id]))

end

# GET /commentonsqueals/1/edit
def edit
end

# POST /commentonsqueals
# POST /commentonsqueals.json
def create
@commentonsqueal = Commentonsqueal.new(commentonsqueal_params)

respond_to do |format|
  if @commentonsqueal.save
    format.html { redirect_to @commentonsqueal, notice: 'Commentonsqueal was successfully created.' }
    format.json { render :show, status: :created, location: @commentonsqueal }
  else
    format.html { render :new }
    format.json { render json: @commentonsqueal.errors, status: :unprocessable_entity }
  end
end

end

# PATCH/PUT /commentonsqueals/1
# PATCH/PUT /commentonsqueals/1.json
def update
respond_to do |format|
if @commentonsqueal.update(commentonsqueal_params)
format.html { redirect_to @commentonsqueal, notice: 'Commentonsqueal was successfully updated.' }
format.json { render :show, status: :ok, location: @commentonsqueal }
else
format.html { render :edit }
format.json { render json: @commentonsqueal.errors, status: :unprocessable_entity }
end
end
end

# DELETE /commentonsqueals/1
# DELETE /commentonsqueals/1.json
def destroy
@commentonsqueal.destroy
respond_to do |format|
format.html { redirect_to commentonsqueals_url, notice: 'Commentonsqueal was successfully destroyed.' }
format.json { head :no_content }
end
end

private
# Use callbacks to share common setup or constraints between actions.
def set_commentonsqueal
@commentonsqueal = Commentonsqueal.find(params[:id])
end

# Never trust parameters from the scary internet, only allow the white list through.
def commentonsqueal_params
  params.require(:commentonsqueal).permit(:squeal_id, :body)
end

end
class SquealsController < ApplicationController
before_action :set_squeal, only: [:show, :edit, :update, :destroy]

# GET /squeals
# GET /squeals.json
def index
@squeals = Squeal.all
@commentonsqueals = Commentonsqueal.all
end

# GET /squeals/1
# GET /squeals/1.json
def show
@comments = Commentonsqueal.all.where("squeal_id = ?", Squeal.find_by_id(params[:id]))
end

# GET /squeals/new
def new
@squeal = Squeal.new

end

# GET /squeals/1/edit
def edit
end

# POST /squeals
# POST /squeals.json
def create

@squeal = Squeal.new(squeal_params)

respond_to do |format|
  if @squeal.save
    format.html { redirect_to @squeal, notice: 'Squeal was successfully created.' }
    format.json { render :show, status: :created, location: @squeal }
  else
    format.html { render :new }
    format.json { render json: @squeal.errors, status: :unprocessable_entity }
  end
end

end

# PATCH/PUT /squeals/1
# PATCH/PUT /squeals/1.json
def update
respond_to do |format|
if @squeal.update(squeal_params)
format.html { redirect_to @squeal, notice: 'Squeal was successfully updated.' }
format.json { render :show, status: :ok, location: @squeal }
else
format.html { render :edit }
format.json { render json: @squeal.errors, status: :unprocessable_entity }
end
end
end

# DELETE /squeals/1
# DELETE /squeals/1.json
def destroy
@squeal.destroy
respond_to do |format|
format.html { redirect_to squeals_url, notice: 'Squeal was successfully destroyed.' }
format.json { head :no_content }
end
end

private
# Use callbacks to share common setup or constraints between actions.
def set_squeal
@squeal = Squeal.find(params[:id])
end

# Never trust parameters from the scary internet, only allow the white list through.
def squeal_params
  params.require(:squeal).permit(:title, :body)
end

end