summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/comments_controller.rb5
-rw-r--r--app/controllers/projects_controller.rb7
-rw-r--r--app/views/browse/index.atom.builder2
-rw-r--r--app/views/comments/index.atom.builder15
-rw-r--r--app/views/layouts/application.html.erb2
-rw-r--r--app/views/projects/index.atom.builder15
6 files changed, 42 insertions, 4 deletions
diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb
index 0d42fb2..159d968 100644
--- a/app/controllers/comments_controller.rb
+++ b/app/controllers/comments_controller.rb
@@ -5,6 +5,11 @@ class CommentsController < ApplicationController
def index
@comments = @repository.comments.find(:all, :include => :user)
+ @atom_auto_discovery = true
+ respond_to do |format|
+ format.html { }
+ format.atom { }
+ end
end
def commit
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index d029c35..3a48787 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -5,9 +5,11 @@ class ProjectsController < ApplicationController
def index
@projects = Project.paginate(:all, :order => "created_at desc",
:page => params[:page])
+ @atom_auto_discovery = true
respond_to do |format|
format.html { @tags = Project.tag_counts }
format.xml { render :xml => @projects }
+ format.atom { }
end
end
@@ -15,13 +17,14 @@ class ProjectsController < ApplicationController
tags = params[:id].to_s.gsub(/,\ ?/, " ")
@projects = Project.paginate_by_tag(tags, :order => 'created_at desc',
:page => params[:page])
-
+ @atom_auto_discovery = true
respond_to do |format|
format.html do
@tags = Project.tag_counts
render :action => "index"
end
- format.xml { render :xml => @projects }
+ format.xml { render :xml => @projects }
+ format.atom { render :action => "index"}
end
end
diff --git a/app/views/browse/index.atom.builder b/app/views/browse/index.atom.builder
index fa79d02..82f45f1 100644
--- a/app/views/browse/index.atom.builder
+++ b/app/views/browse/index.atom.builder
@@ -1,5 +1,5 @@
atom_feed do |feed|
- feed.title("#{@project.title} - #{@repository.name}")
+ feed.title("Gitorious: #{@project.title} - #{@repository.name}")
feed.updated((@commits.first.date))
@commits.each do |commit|
diff --git a/app/views/comments/index.atom.builder b/app/views/comments/index.atom.builder
new file mode 100644
index 0000000..8c69fe7
--- /dev/null
+++ b/app/views/comments/index.atom.builder
@@ -0,0 +1,15 @@
+atom_feed do |feed|
+ feed.title("Gitorious: #{@repository.name} comments")
+ feed.updated((@comments.first.created_at))
+
+ @comments.each do |comment|
+ item_url = project_repository_comments_path(@project,@repository)
+ feed.entry(comment, :url => item_url) do |entry|
+ entry.title("#{comment.user.login}: #{truncate(comment.body, 30)}")
+ entry.content(comment.body)
+ entry.author do |author|
+ author.name(comment.user.login)
+ end
+ end
+ end
+end \ No newline at end of file
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index b1661fc..3e9a745 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -8,7 +8,7 @@
<%= stylesheet_link_tag "base" -%>
<%= javascript_include_tag :defaults, :cache => true -%>
<% if @atom_auto_discovery -%>
- <%= auto_discovery_link_tag(:atom) -%>
+ <%= auto_discovery_link_tag(:atom, :format => :atom) -%>
<% end -%>
<%= GitoriousConfig["extra_html_head_data"] -%>
</head>
diff --git a/app/views/projects/index.atom.builder b/app/views/projects/index.atom.builder
new file mode 100644
index 0000000..e5db8c0
--- /dev/null
+++ b/app/views/projects/index.atom.builder
@@ -0,0 +1,15 @@
+atom_feed do |feed|
+ feed.title("Gitorious: projects")
+ feed.updated((@projects.first.created_at))
+
+ @projects.each do |project|
+ item_url = project_path(project)
+ feed.entry(project, :url => item_url) do |entry|
+ entry.title(project.title)
+ entry.content(project.description)
+ entry.author do |author|
+ author.name("Gitorious")
+ end
+ end
+ end
+end \ No newline at end of file