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
|
class CommentsController < ApplicationController
|
||||||
COMMENTS_PER_PAGE = 20
|
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,
|
before_filter :require_logged_in_user_or_400,
|
||||||
:only => [ :create, :preview, :upvote, :downvote, :unvote ]
|
:only => [ :create, :preview, :upvote, :downvote, :unvote ]
|
||||||
|
|
||||||
|
@ -221,6 +223,17 @@ class CommentsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
def threads
|
def threads
|
||||||
|
|
|
@ -42,6 +42,8 @@ class HomeController < ApplicationController
|
||||||
|
|
||||||
@rss_link ||= { :title => "RSS 2.0",
|
@rss_link ||= { :title => "RSS 2.0",
|
||||||
:href => "/rss#{@user ? "?token=#{@user.rss_token}" : ""}" }
|
: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 = ""
|
@heading = @title = ""
|
||||||
@cur_url = "/"
|
@cur_url = "/"
|
||||||
|
|
|
@ -29,6 +29,11 @@
|
||||||
<link rel="alternate" type="application/rss+xml"
|
<link rel="alternate" type="application/rss+xml"
|
||||||
title="<%= @rss_link[:title] %>" href="<%= @rss_link[:href] %>" />
|
title="<%= @rss_link[:title] %>" href="<%= @rss_link[:href] %>" />
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% if @comments_rss_link %>
|
||||||
|
<link rel="alternate" type="application/rss+xml"
|
||||||
|
title="<%= @comments_rss_link[:title] %>"
|
||||||
|
href="<%= @comments_rss_link[:href] %>" />
|
||||||
|
<% end %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="wrapper">
|
<div id="wrapper">
|
||||||
|
|
|
@ -73,6 +73,7 @@ Lobsters::Application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
get "/comments/page/:page" => "comments#index"
|
get "/comments/page/:page" => "comments#index"
|
||||||
|
get "/comments" => "comments#index", :format => /html|rss/
|
||||||
|
|
||||||
get "/messages/sent" => "messages#sent"
|
get "/messages/sent" => "messages#sent"
|
||||||
post "/messages/batch_delete" => "messages#batch_delete",
|
post "/messages/batch_delete" => "messages#batch_delete",
|
||||||
|
|
Loading…
Reference in a new issue