diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-12-04 23:14:20 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-12-04 23:14:20 +0300 |
commit | d31d711a70779132ea43387f93eb4ccc1e472761 (patch) | |
tree | 815c0ae6a327e2937482a43d2b21cf15ac6871c0 /app/views/users/show.atom.builder | |
parent | a46fe875c6aea206e575e2b083bd31ed36ee1b1e (diff) |
DRY and refactor atom code
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/views/users/show.atom.builder')
-rw-r--r-- | app/views/users/show.atom.builder | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/app/views/users/show.atom.builder b/app/views/users/show.atom.builder index 0d61a9e8097..b7216a88765 100644 --- a/app/views/users/show.atom.builder +++ b/app/views/users/show.atom.builder @@ -1,29 +1,12 @@ xml.instruct! -xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do +xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlnsmedia" => "http://search.yahoo.com/mrss/" do xml.title "Activity feed for #{@user.name}" - xml.link :href => user_url(@user, :atom), :rel => "self", :type => "application/atom+xml" - xml.link :href => user_url(@user), :rel => "alternate", :type => "text/html" + xml.link href: user_url(@user, :atom), rel: "self", type: "application/atom+xml" + xml.link href: user_url(@user), rel: "alternate", type: "text/html" xml.id projects_url xml.updated @events.maximum(:updated_at).strftime("%Y-%m-%dT%H:%M:%SZ") if @events.any? @events.each do |event| - if event.proper? - xml.entry do - event_link = event_feed_url(event) - event_title = event_feed_title(event) - event_summary = event_feed_summary(event) - - xml.id "tag:#{request.host},#{event.created_at.strftime("%Y-%m-%d")}:#{event.id}" - xml.link :href => event_link - xml.title truncate(event_title, :length => 80) - xml.updated event.created_at.strftime("%Y-%m-%dT%H:%M:%SZ") - xml.media :thumbnail, :width => "40", :height => "40", :url => avatar_icon(event.author_email) - xml.author do |author| - xml.name event.author_name - xml.email event.author_email - end - xml.summary(:type => "xhtml") { |x| x << event_summary unless event_summary.nil? } - end - end + event_to_atom(xml, event) end end |