Include a comment link in the diary RSS feed.

This commit is contained in:
Tom Hughes 2008-01-18 10:43:21 +00:00
parent 755b9711b5
commit bb905aa285
3 changed files with 6 additions and 3 deletions

View file

@ -5,7 +5,7 @@ Coordinates: <div class="geo" style="display: inline"><span class="latitude"><%=
<% end %> <% end %>
Posted by <b><%= link_to diary_entry.user.display_name, :controller => 'user', :action => 'view', :display_name => diary_entry.user.display_name %></b> at <%= diary_entry.created_at %><br /> Posted by <b><%= link_to diary_entry.user.display_name, :controller => 'user', :action => 'view', :display_name => diary_entry.user.display_name %></b> at <%= diary_entry.created_at %><br />
<% if params[:action] == 'list' %> <% if params[:action] == 'list' %>
<%= link_to 'Comment on this entry', :action => 'view', :display_name => diary_entry.user.display_name, :id => diary_entry.id, :anchor => 'comment' %> <%= link_to 'Comment on this entry', :action => 'view', :display_name => diary_entry.user.display_name, :id => diary_entry.id, :anchor => 'newcomment' %>
| |
<%= link_to 'Reply to this entry', :controller => 'message', :action => 'new', :user_id => diary_entry.user.id, :title => "Re: #{diary_entry.title}" %> <%= link_to 'Reply to this entry', :controller => 'message', :action => 'new', :user_id => diary_entry.user.id, :title => "Re: #{diary_entry.title}" %>
<% end %> <% end %>

View file

@ -23,6 +23,7 @@ xml.rss("version" => "2.0",
xml.description htmlize(entry.body) xml.description htmlize(entry.body)
xml.author entry.user.display_name xml.author entry.user.display_name
xml.pubDate entry.created_at.to_s(:rfc822) xml.pubDate entry.created_at.to_s(:rfc822)
xml.comments url_for(:action => "view", :id => entry.id, :display_name => entry.user.display_name, :anchor => "comments", :only_path => false)
if entry.latitude and entry.longitude if entry.latitude and entry.longitude
xml.geo :lat, entry.latitude.to_s xml.geo :lat, entry.latitude.to_s

View file

@ -2,11 +2,13 @@
<%= render :partial => 'diary_entry', :object => @entry %> <%= render :partial => 'diary_entry', :object => @entry %>
<a id="comments"></a>
<%= render :partial => 'diary_comment', :collection => @entry.diary_comments %> <%= render :partial => 'diary_comment', :collection => @entry.diary_comments %>
<% if @user %> <% if @user %>
<h4 id="comment">Leave a comment</h4> <h4 id="newcomment">Leave a comment</h4>
<%= error_messages_for 'diary_comment' %> <%= error_messages_for 'diary_comment' %>
<% form_for :diary_comment, @diary_comment, :url => { :action => 'comment' } do |f| %> <% form_for :diary_comment, @diary_comment, :url => { :action => 'comment' } do |f| %>
<%= f.text_area :body, :cols => 80, :rows => 5 %> <%= f.text_area :body, :cols => 80, :rows => 5 %>
@ -17,6 +19,6 @@
<% else %> <% else %>
<h4 id="comment"><%= link_to "Login", :controller => 'user', :action => 'login', :referer => request.request_uri %> to leave a comment</h4> <h4 id="newcomment"><%= link_to "Login", :controller => 'user', :action => 'login', :referer => request.request_uri %> to leave a comment</h4>
<% end %> <% end %>