refactoring views
This commit is contained in:
1
app/views/comments/create.js.erb
Normal file
1
app/views/comments/create.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
$("div.comments-for-post[data-post-id=<%= @comment.post_id %>] div.list-of-comments").append("<%= escape_javascript(render('comments/partials/show/comment', :comment => @comment)) %>");
|
||||
@@ -1 +0,0 @@
|
||||
page.insert_html(:bottom, "div.comments-for-post[data-post-id=#{@comment.post_id}] div.list-of-comments", :partial => "comments/partials/show/comment", :locals => {:comment => @comment})
|
||||
@@ -5,7 +5,7 @@
|
||||
<div class="comments-for-post">
|
||||
<div class="list-of-comments">
|
||||
<% @comments.each do |comment| %>
|
||||
<%= render :partial => "comments/partials/show/comment", :locals => {:post => comment.post, :comment => comment, :show_header => false} %>
|
||||
<%= render "comments/partials/show/comment", :post => comment.post, :comment => comment, :show_header => false %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<div class="preview">
|
||||
<%= link_to(image_tag(post.preview_file_url), post_path(post)) %>
|
||||
</div>
|
||||
<%= render :partial => "comments/partials/index/list", :locals => {:post => post, :comments => post.comments.recent.reverse, :show_header => true} %>
|
||||
<%= render "comments/partials/index/list", :post => post, :comments => post.comments.recent.reverse, :show_header => true %>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -20,4 +20,4 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "comments/secondary_links" %>
|
||||
<%= render "comments/secondary_links" %>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="comments-for-post" data-post-id="<%= post.id %>">
|
||||
<% if show_header %>
|
||||
<%= render :partial => "comments/partials/index/header", :locals => {:post => post} %>
|
||||
<%= render "comments/partials/index/header", :post => post %>
|
||||
<% end %>
|
||||
|
||||
<div class="list-of-comments">
|
||||
@@ -15,6 +15,6 @@
|
||||
|
||||
<div class="new-comment">
|
||||
<p><%= link_to "Post comment", new_comment_path, :class => "expand-comment-response" %></p>
|
||||
<%= render :partial => "comments/partials/new/form", :locals => {:post => post} %>
|
||||
<%= render "comments/partials/new/form", :post => post %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user