refactoring views

This commit is contained in:
albert
2011-08-16 18:47:01 -04:00
parent c8067a4691
commit 24bf21540a
46 changed files with 244 additions and 298 deletions

View 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)) %>");

View File

@@ -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})

View File

@@ -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>

View File

@@ -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" %>

View File

@@ -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>