Rework the generation of descriptions in the notes RSS feed

This commit is contained in:
Tom Hughes 2013-04-26 19:34:32 +01:00
parent b1308a87be
commit 5dda4196d5
5 changed files with 17 additions and 22 deletions

View file

@ -0,0 +1,8 @@
<div class="note-comment" style="margin-top: 5px">
<% if comment.author.nil? -%>
<div class="note-comment-description" style="font-size: smaller; color: #999999"><%= t "note.description.#{comment.event}_at", :when => friendly_date(comment.created_at) %></div>
<% else -%>
<div class="note-comment-description" style="font-size: smaller; color: #999999"><%= t "note.description.#{comment.event}_at_by", :when => friendly_date(comment.created_at), :user => note_author(comment.author, :only_path => false) %></div>
<% end -%>
<div class="note-comment-text"><%= comment.body %></div>
</div>

View file

@ -1,12 +1,3 @@
<div>
<% description.comments.each do |comment| -%>
<div class="note-comment" style="margin-top: 5px">
<% if comment.author.nil? -%>
<div class="note-comment-description" style="font-size: smaller; color: #999999"><%= t "note.description.#{comment.event}_at", :when => friendly_date(comment.created_at) %></div>
<% else -%>
<div class="note-comment-description" style="font-size: smaller; color: #999999"><%= t "note.description.#{comment.event}_at_by", :when => friendly_date(comment.created_at), :user => note_author(comment.author, :only_path => false) %></div>
<% end -%>
<div class="note-comment-text"><%= comment.body %></div>
</div>
<% end -%>
<%= render :partial => "comment", :collection => description.comments %>
</div>

View file

@ -0,0 +1,4 @@
<h2><%= t "note.entry.comment" %></h2>
<%= render :partial => "comment", :object => entry %>
<h2><%= t "note.entry.full" %></h2>
<%= render :partial => "description", :object => entry.note %>

View file

@ -25,18 +25,7 @@ xml.rss("version" => "2.0",
xml.link url_for(:controller => "browse", :action => "note", :id => comment.note.id, :only_path => false)
xml.guid url_for(:controller => "browse", :action => "note", :id => comment.note.id, :only_path => false)
description_text = ""
if comment.event == "commented" and not comment.nil?
description_text += "<b>Comment:</b><br>"
description_text += comment.body.to_html
description_text += "<br>"
end
description_text += "<b>Full note:</b><br>"
description_text += comment.note.flatten_comment("<br>", comment.created_at)
xml.description description_text
xml.description render(:partial => "entry", :object => comment, :formats => [ :html ])
if comment.author
xml.author comment.author.display_name