> What's in the _comment partial ?
get ready.... this is a pretty hairy partial... This was my first shot
at coming up with a javascript driven comment system. Any tips on
things to change would be appreciated.
<%div_for(comment) do %>
<div id="comment_user"><%= user_for(comment.user_id)%><div
class="time"><%= time_ago(comment.created_at)%></div></div>
<div id="message"><%= comment.body %></div>
<div class="cvote_area">
<%if !logged_in? %>
<div class="ranked"><span
id="up">ranked!</span><span
id="down">ranked!</span></div>
<%else%>
<div id="vote_form_<%=comment.id%>"
class="cvote_form">
<% form_remote_for [comment, Vote.new],
:html => {:id =>
"new_vote_up"} do |f| %>
<div id="up">
<%= f.submit 'up', :id
=> 'up',:onmouseover
=>"this.className='hov_up'", :onmouseout =>"this.className=''" %>
</div>
<% end %>
<% form_remote_for [comment, Vote.new],
:html => {:id =>
"new_vote_down"} do |f| %>
<div id="down">
<%= f.submit 'down',
:id => 'down',:onmouseover
=>"this.className='hov_down'", :onmouseout =>"this.className=''" %>
</div>
<% end %>
<div class ="clear"></div>
</div>
<%end%>
<div id="vote_score_<%=comment.id%>" class="cvote_score">
<%= comment.reload.total_votes %>
</div>
</div>
<div class="clear"></div>
<div id="comment_footer_<%=comment.id%>" class="comment_footer">
<%= comment_reply_tag(comment)%>
</div>
<div id="comment_replies_<%=comment.id%>" style="display:none">
<div id="reply_form_<%=comment.id%>" class="reply_form" >
<% form_remote_for [...@submission, Comment.new], :html
=> {:id =>
"reply_field_#{comment.id}"} do |f| %>
<%= hidden_field_tag "comment_id",
"#{comment.id}"%>
<%= hidden_field_tag "status", "reply"%>
<%= f.text_area :body%>
<%= f.submit "Submit"%>
<% end %>
</div>
<div class="clear"></div>
<div id="reply_left_<%=comment.id%>" >
<%= link_to_function "reply", :id => "reply_link" do
|page|
page.show("reply_form_#{comment.id}")
end%>
</div>
</div>
<%end %>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---