Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add rss feed #11

  • Loading branch information...
commit 169334b0ede091303b41d24a91cfb190d657ce61 1 parent 377ce10
@happypeter authored
View
BIN  app/assets/images/rss.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
6 app/assets/stylesheets/peter.css.scss
@@ -604,4 +604,8 @@ textarea#episode_notes {
padding: 20px;
padding-bottom: 1px;
}
-
+#rss-tag {
+ float: right;
+ margin-bottom: 20px;
+ clear: both;
+}
View
19 app/views/episodes/feed.builder
@@ -0,0 +1,19 @@
+xml.instruct! :xml, :version=>"1.0"
+xml.rss(:version=>"2.0"){
+ xml.channel{
+ xml.title t("rss.recent_topics_title", :name => Setting.app_name)
+ xml.link root_url
+ xml.description(t("rss.recent_topics_description", :name => Setting.app_name ))
+ xml.language('en-us')
+ for topic in @topics
+ xml.item do
+ xml.title topic.title
+ xml.description raw(topic.body_html)
+ xml.author topic.user.login
+ xml.pubDate(topic.created_at.strftime("%a, %d %b %Y %H:%M:%S %z"))
+ xml.link topic_url topic
+ xml.guid topic_url topic
+ end
+ end
+ }
+}
View
6 app/views/episodes/index.html.erb
@@ -1,3 +1,6 @@
+<% content_for :head, auto_discovery_link_tag(:rss, episodes_url(format: "rss")) %>
+
+
<div class="row-fluid">
<div class="span10">
<% for episode in @episodes %>
@@ -6,6 +9,9 @@
<% end %>
</div>
<div class="span2">
+ <div id="rss-tag">
+ <%= link_to image_tag("rss.png"), episodes_url(format: "rss") %>
+ </div>
<div class="categories">
<div class="categories_title">
Categroies
View
18 app/views/episodes/index.rss.builder
@@ -0,0 +1,18 @@
+xml.instruct! :xml, version: "1.0"
+xml.rss version: "2.0" do
+ xml.channel do
+ xml.title "Superhero Articles"
+ xml.description "From Batman to Superman"
+ xml.link episodes_url
+
+ @episodes.each do |ep|
+ xml.item do
+ xml.title ep.name
+ xml.description ep.description
+ xml.pubDate ep.published_at.to_s(:rfc822)
+ xml.link episode_url(ep)
+ xml.guid episode_url(ep)
+ end
+ end
+ end
+end
View
BIN  app/views/layouts/.application.html.erb.swp
Binary file not shown
View
2  app/views/layouts/application.html.erb
@@ -7,7 +7,7 @@
<%= javascript_include_tag "application"%>
<%= javascript_include_tag "http://cdn.sublimevideo.net/js/2d4ddo2n.js" %>
<%= csrf_meta_tag %>
-
+ <%= yield :head %>
</head>
<body>
<div id="wrapper">

2 comments on commit 169334b

Please sign in to comment.
Something went wrong with that request. Please try again.