add comments rss feed
The RSS view was already here but never setup in a controller. Closes #202
This commit is contained in:
parent
b4444c58c9
commit
c2442a5881
|
@ -1,6 +1,8 @@
|
|||
class CommentsController < ApplicationController
|
||||
COMMENTS_PER_PAGE = 20
|
||||
|
||||
# for rss feeds, load the user's tag filters if a token is passed
|
||||
before_filter :find_user_from_rss_token, :only => [ :index ]
|
||||
before_filter :require_logged_in_user_or_400,
|
||||
:only => [ :create, :preview, :upvote, :downvote, :unvote ]
|
||||
|
||||
|
@ -221,6 +223,17 @@ class CommentsController < ApplicationController
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render :action => "index" }
|
||||
format.rss {
|
||||
if @user && params[:token].present?
|
||||
@title = "Private comments feed for #{@user.username}"
|
||||
end
|
||||
|
||||
render :action => "index.rss", :layout => false
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def threads
|
||||
|
|
|
@ -42,6 +42,8 @@ class HomeController < ApplicationController
|
|||
|
||||
@rss_link ||= { :title => "RSS 2.0",
|
||||
:href => "/rss#{@user ? "?token=#{@user.rss_token}" : ""}" }
|
||||
@comments_rss_link ||= { :title => "Comments - RSS 2.0",
|
||||
:href => "/comments.rss#{@user ? "?token=#{@user.rss_token}" : ""}" }
|
||||
|
||||
@heading = @title = ""
|
||||
@cur_url = "/"
|
||||
|
|
|
@ -29,6 +29,11 @@
|
|||
<link rel="alternate" type="application/rss+xml"
|
||||
title="<%= @rss_link[:title] %>" href="<%= @rss_link[:href] %>" />
|
||||
<% end %>
|
||||
<% if @comments_rss_link %>
|
||||
<link rel="alternate" type="application/rss+xml"
|
||||
title="<%= @comments_rss_link[:title] %>"
|
||||
href="<%= @comments_rss_link[:href] %>" />
|
||||
<% end %>
|
||||
</head>
|
||||
<body>
|
||||
<div id="wrapper">
|
||||
|
|
|
@ -73,6 +73,7 @@ Lobsters::Application.routes.draw do
|
|||
end
|
||||
end
|
||||
get "/comments/page/:page" => "comments#index"
|
||||
get "/comments" => "comments#index", :format => /html|rss/
|
||||
|
||||
get "/messages/sent" => "messages#sent"
|
||||
post "/messages/batch_delete" => "messages#batch_delete",
|
||||
|
|
Loading…
Reference in a new issue