Commit 24d5ad70d8d132cb0f50b79deb5eb4e55b6a825f
- Date: Tue Apr 29 17:29:20 +0000 2008
- Committer: David A. Cuadrado (krawek@gmail.com)
- Author: David A. Cuadrado (krawek@gmail.com)
- Commit SHA1: 24d5ad70d8d132cb0f50b79deb5eb4e55b6a825f
- Tree SHA1: 38745e0b2725c449f254775eb33e1c172c6a1803
atom feed for /events.
Signed-off-by: David A. Cuadrado <krawek@gmail.com>
Commit diff
| |   |
| 2 | 2 | def index |
| 3 | 3 | @events = Event.paginate(:all, :order => "events.created_at asc", |
| 4 | 4 | :page => params[:page], :include => [:user]) |
| 5 | @atom_auto_discovery_url = formatted_events_path(:atom) |
| 6 | |
| 7 | respond_to do |if_format_is| |
| 8 | if_format_is.html {} |
| 9 | if_format_is.atom {} |
| 10 | end |
| 5 | 11 | end |
| 6 | 12 | |
| 7 | 13 | end |
| toggle raw diff |
--- a/app/controllers/events_controller.rb
+++ b/app/controllers/events_controller.rb
@@ -2,6 +2,12 @@ class EventsController < ApplicationController
def index
@events = Event.paginate(:all, :order => "events.created_at asc",
:page => params[:page], :include => [:user])
+ @atom_auto_discovery_url = formatted_events_path(:atom)
+
+ respond_to do |if_format_is|
+ if_format_is.html {}
+ if_format_is.atom {}
+ end
end
end |
| |   |
| 1 | atom_feed do |feed| |
| 2 | feed.title("Gitorious activities") |
| 3 | feed.updated((@events.blank? ? Time.now : @events.first.created_at)) |
| 4 | |
| 5 | @events.each do |event| |
| 6 | action, body, category = action_and_body_for_event(event) |
| 7 | feed.entry(event, :url => events_url) do |entry| |
| 8 | entry.title("#{h(event.user.login)} #{strip_tags(action)}") |
| 9 | entry.content(<<-EOS, :type => 'html') |
| 10 | <p>#{link_to event.user.login, user_path(event.user)} #{action}</p> |
| 11 | <p>#{body}<p> |
| 12 | EOS |
| 13 | entry.author do |author| |
| 14 | author.name(event.user.login) |
| 15 | end |
| 16 | end |
| 17 | end |
| 18 | end |
| toggle raw diff |
--- /dev/null
+++ b/app/views/events/index.atom.builder
@@ -0,0 +1,18 @@
+atom_feed do |feed|
+ feed.title("Gitorious activities")
+ feed.updated((@events.blank? ? Time.now : @events.first.created_at))
+
+ @events.each do |event|
+ action, body, category = action_and_body_for_event(event)
+ feed.entry(event, :url => events_url) do |entry|
+ entry.title("#{h(event.user.login)} #{strip_tags(action)}")
+ entry.content(<<-EOS, :type => 'html')
+<p>#{link_to event.user.login, user_path(event.user)} #{action}</p>
+<p>#{body}<p>
+EOS
+ entry.author do |author|
+ author.name(event.user.login)
+ end
+ end
+ end
+end |
| |   |
| 1 | 1 | <% @page_title = "Events" -%> |
| 2 | 2 | |
| 3 | <h2>System Activities<%= link_to image_tag("feed.png", :width => 24, :height => 24), @atom_auto_discovery_url %></h2> |
| 4 | |
| 3 | 5 | <%= render :partial => "events", :object => @events -%> |
| 4 | 6 | |
| 5 | | <%= will_paginate @events -%> |
| toggle raw diff |
--- a/app/views/events/index.html.erb
+++ b/app/views/events/index.html.erb
@@ -1,5 +1,6 @@
<% @page_title = "Events" -%>
+<h2>System Activities<%= link_to image_tag("feed.png", :width => 24, :height => 24), @atom_auto_discovery_url %></h2>
+
<%= render :partial => "events", :object => @events -%>
-<%= will_paginate @events -%> |