adding feeds to major categories
git-svn-id: http://svn.barleysodas.com/barleysodas/trunk@125 0f7b21a7-9e3a-4941-bbeb-ce5c7c368fa7master
parent
98a3db040b
commit
52c36c3891
|
@ -5,16 +5,21 @@ class BeersController < ApplicationController
|
|||
# GET /beers
|
||||
# GET /beers.xml
|
||||
def index
|
||||
@content_title = 'The Beers'
|
||||
@secondary_title = 'Browsing all beers'
|
||||
@pages, @beers = paginate :beers, :include => 'page', :per_page => per_page,
|
||||
:order => 'beers.title ASC'
|
||||
flash.now[:notice] = 'There are no beers yet.' if @beers.empty?
|
||||
@tags = Page.tags(:limit => 25, :order => "name DESC",
|
||||
:owner_type => 'Beer')
|
||||
respond_to do |format|
|
||||
format.html # index.rhtml
|
||||
format.xml { render :xml => @beers.to_xml }
|
||||
format.html do
|
||||
@content_title = 'The Beers'
|
||||
@secondary_title = 'Browsing all beers'
|
||||
@pages, @beers = paginate :beers, :include => 'page', :per_page => per_page,
|
||||
:order => 'beers.title ASC'
|
||||
flash.now[:notice] = 'There are no beers yet.' if @beers.empty?
|
||||
@tags = Page.tags(:limit => 25, :order => "name DESC",
|
||||
:owner_type => 'Beer')
|
||||
end
|
||||
format.rss do
|
||||
@beers = Beer.find :all, :order => 'beers.created_at DESC',
|
||||
:limit => per_page
|
||||
render :partial => 'beers'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -5,18 +5,21 @@ class BreweriesController < ApplicationController
|
|||
# GET /breweries
|
||||
# GET /breweries.xml
|
||||
def index
|
||||
@content_title = 'The Breweries'
|
||||
@secondary_title = 'Browsing all breweries'
|
||||
@pages, @breweries = paginate :breweries, :include => 'page',
|
||||
:order => 'breweries.title ASC', :per_page => per_page
|
||||
if @breweries.empty?
|
||||
flash.now[:notice] = 'There are no breweries yet.'
|
||||
end
|
||||
@tags = Page.tags(:limit => 25, :order => "name DESC",
|
||||
:owner_type => 'Beer')
|
||||
respond_to do |format|
|
||||
format.html # index.rhtml
|
||||
format.xml { render :xml => @breweries.to_xml }
|
||||
format.html do
|
||||
@content_title = 'The Breweries'
|
||||
@secondary_title = 'Browsing all breweries'
|
||||
@pages, @breweries = paginate :breweries, :include => 'page',
|
||||
:order => 'breweries.title ASC', :per_page => per_page
|
||||
flash.now[:notice] = 'There are no breweries yet.' if @breweries.empty?
|
||||
@tags = Page.tags(:limit => 25, :order => "name DESC",
|
||||
:owner_type => 'Beer')
|
||||
end
|
||||
format.rss do
|
||||
@breweries = Brewery.find :all, :order => 'breweries.created_at DESC',
|
||||
:limit => per_page
|
||||
render :partial => 'breweries'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ class DiscussionsController < ApplicationController
|
|||
:conditions => [ 'allow_discussions = ?', true ], :per_page => per_page,
|
||||
:include => [ 'discussions' ]
|
||||
respond_to do |format|
|
||||
format.html # index.rhtml
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -23,8 +23,8 @@ class DiscussionsController < ApplicationController
|
|||
@pages, @discussions = paginate :discussion, :order => 'created_at ASC',
|
||||
:conditions => [ 'page_id = ?', @page.id ], :per_page => per_page
|
||||
respond_to do |format|
|
||||
format.html # show.rhtml
|
||||
format.xml { render :xml => @discussions.to_xml }
|
||||
format.html
|
||||
format.rss { render :partial => 'discussions' }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class ExperiencesController < ApplicationController
|
|||
end
|
||||
format.rss do
|
||||
@experiences = @people.experiences.find :all, :limit => per_page,
|
||||
:order => 'created_at DESC'
|
||||
:order => 'experiences.created_at DESC'
|
||||
render :partial => 'experiences'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,21 +5,24 @@ class PagesController < ApplicationController
|
|||
# GET /pages
|
||||
# GET /pages.xml
|
||||
def index
|
||||
@page = Page.find_by_title_and_owner_type 'HomePage', nil
|
||||
@page ||= Page.create :title => 'HomePage',
|
||||
:redcloth => 'Welcome to BarleySodas!'
|
||||
@content_title = 'The Beer Wiki'
|
||||
@secondary_title = 'Browsing all pages'
|
||||
|
||||
cond_ary = [ 'owner_id IS NULL' ]
|
||||
cond_ary << "title <> 'HomePage'"
|
||||
@pages, @wiki_pages = paginate :page, :per_page => per_page,
|
||||
:order => 'title ASC', :conditions => [ cond_ary.join(' AND ') ]
|
||||
|
||||
@tags = Page.tags(:limit => 25, :order => "name ASC")
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.rhtml
|
||||
format.html do
|
||||
@page = Page.find_by_title_and_owner_type 'HomePage', nil
|
||||
@page ||= Page.create :title => 'HomePage',
|
||||
:redcloth => 'Welcome to BarleySodas!'
|
||||
@content_title = 'The Beer Wiki'
|
||||
@secondary_title = 'Browsing all pages'
|
||||
cond_ary = [ 'owner_id IS NULL' ]
|
||||
cond_ary << "title <> 'HomePage'"
|
||||
@pages, @wiki_pages = paginate :page, :per_page => per_page,
|
||||
:order => 'title ASC', :conditions => [ cond_ary.join(' AND ') ]
|
||||
@tags = Page.tags(:limit => 25, :order => "name ASC")
|
||||
end
|
||||
format.rss do
|
||||
@pages = Page.find :all, :order => 'updated_at DESC',
|
||||
:limit => per_page, :conditions => [ 'owner_type IS NULL' ]
|
||||
render :partial => 'pages'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -5,14 +5,19 @@ class PeoplesController < ApplicationController
|
|||
# GET /peoples
|
||||
# GET /peoples.xml
|
||||
def index
|
||||
@secondary_title = 'Browsing all Peoples'
|
||||
@pages, @peoples = paginate :people, :per_page => per_page,
|
||||
:order => 'title ASC', :singular_name => 'people'
|
||||
@tags = Page.tags(:limit => 25, :order => "name DESC",
|
||||
:owner_type => 'People')
|
||||
respond_to do |format|
|
||||
format.html # index.rhtml
|
||||
format.xml { render :xml => @people.to_xml }
|
||||
format.html do
|
||||
@secondary_title = 'Browsing all Peoples'
|
||||
@pages, @peoples = paginate :people, :per_page => per_page,
|
||||
:order => 'title ASC', :singular_name => 'people'
|
||||
@tags = Page.tags(:limit => 25, :order => "name DESC",
|
||||
:owner_type => 'People')
|
||||
end
|
||||
format.rss do
|
||||
@peoples = People.find :all, :order => 'peoples.created_at DESC',
|
||||
:limit => per_page
|
||||
render :partial => 'peoples'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
xml.instruct! :xml, :version=>"1.0"
|
||||
xml.rss(:version=>"2.0"){
|
||||
xml.channel{
|
||||
xml.title("BarleySodas Newest Beers")
|
||||
xml.link(beers_url)
|
||||
xml.description("The newest experience points added into BarleySodas.")
|
||||
xml.lastBuildDate((@beers.first.created_at.strftime("%a, %d %b %Y %H:%M:%S %z") rescue nil))
|
||||
xml.language('en-us')
|
||||
for beer in @beers
|
||||
xml.item do
|
||||
xml.title(beer.title)
|
||||
xml.description(beer.brewery.title)
|
||||
xml.author(beer.page.created_by.title)
|
||||
xml.pubDate(beer.created_at.strftime("%a, %d %b %Y %H:%M:%S %z"))
|
||||
xml.link(beer_url(beer.page.title_for_url))
|
||||
xml.guid(beer_url(beer.page.title_for_url))
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
|
@ -8,3 +8,7 @@
|
|||
<%= link_to "New Beer", new_beer_path, { :title => 'Create a new beer' } -%><br />
|
||||
<%= render :partial => 'shared/tag_cloud' %>
|
||||
<% end -%>
|
||||
|
||||
<% content_for :auto_discoveries do -%>
|
||||
<%= auto_discovery_link_tag :rss, { :format => :rss } %>
|
||||
<% end -%>
|
|
@ -0,0 +1,20 @@
|
|||
xml.instruct! :xml, :version=>"1.0"
|
||||
xml.rss(:version=>"2.0"){
|
||||
xml.channel{
|
||||
xml.title("BarleySodas Newest Breweries")
|
||||
xml.link(breweries_url)
|
||||
xml.description("The newest breweries added into BarleySodas.")
|
||||
xml.lastBuildDate((@breweries.first.created_at.strftime("%a, %d %b %Y %H:%M:%S %z") rescue nil))
|
||||
xml.language('en-us')
|
||||
for brewery in @breweries
|
||||
xml.item do
|
||||
xml.title(brewery.title)
|
||||
xml.description(brewery.homepage)
|
||||
xml.author(brewery.page.created_by.title)
|
||||
xml.pubDate(brewery.created_at.strftime("%a, %d %b %Y %H:%M:%S %z"))
|
||||
xml.link(brewery_url(brewery.page.title_for_url))
|
||||
xml.guid(brewery_url(brewery.page.title_for_url))
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
|
@ -8,3 +8,7 @@
|
|||
<%= link_to 'New brewery', new_brewery_path -%><br />
|
||||
<%= render :partial => 'shared/tag_cloud' %>
|
||||
<% end -%>
|
||||
|
||||
<% content_for :auto_discoveries do -%>
|
||||
<%= auto_discovery_link_tag :rss, { :format => :rss } %>
|
||||
<% end -%>
|
|
@ -0,0 +1,20 @@
|
|||
xml.instruct! :xml, :version=>"1.0"
|
||||
xml.rss(:version=>"2.0"){
|
||||
xml.channel{
|
||||
xml.title("Discussion Thread for #{@page.title}")
|
||||
xml.link(discussion_url(@page))
|
||||
xml.description("All posts in the thread.")
|
||||
xml.language('en-us')
|
||||
xml.lastBuildDate((@discussions.last.created_at.strftime("%a, %d %b %Y %H:%M:%S %z") rescue nil))
|
||||
for discussion in @discussions
|
||||
xml.item do
|
||||
xml.title("Item posted at #{discussion.created_at}")
|
||||
xml.description(discussion.text)
|
||||
xml.author("Unknown, right now.")
|
||||
xml.pubDate(discussion.created_at.strftime("%a, %d %b %Y %H:%M:%S %z"))
|
||||
xml.link(discussion_url(@page))
|
||||
xml.guid(discussion_url(@page))
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
|
@ -13,3 +13,7 @@
|
|||
<% content_for 'sidebar' do -%>
|
||||
<%= page_or_parent_link(@page) -%><br />
|
||||
<% end -%>
|
||||
|
||||
<% content_for :auto_discoveries do -%>
|
||||
<%= auto_discovery_link_tag :rss, { :format => :rss } %>
|
||||
<% end -%>
|
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<rss version="2.0">
|
||||
<channel>
|
||||
<title><%= @people.title -%>'s Beers</title>
|
||||
<link><%= experience_path(@people.page.title_for_url) -%></link>
|
||||
<description>Most recently added beers</description>
|
||||
<lastBuildDate><%= @experiences.first.created_at rescue '' -%></lastBuildDate>
|
||||
<% for experience in @experiences -%>
|
||||
<item>
|
||||
<title><%= experience.beer.title -%></title>
|
||||
<link><%= show_beer_link(experience.beer) -%></link>
|
||||
<description><%= experience.beer.brewery.title -%></description>
|
||||
<pubDate><%= experience.created_at -%></pubDate>
|
||||
</item>
|
||||
<% end -%>
|
||||
</channel>
|
||||
</rss>
|
|
@ -0,0 +1,20 @@
|
|||
xml.instruct! :xml, :version=>"1.0"
|
||||
xml.rss(:version=>"2.0"){
|
||||
xml.channel{
|
||||
xml.title("#{@people.title}'s Newest Beers")
|
||||
xml.link(experience_url(@people.page.title_for_url))
|
||||
xml.description("Most recently added beers.")
|
||||
xml.language('en-us')
|
||||
xml.lastBuildDate((@experiences.first.created_at.strftime("%a, %d %b %Y %H:%M:%S %z") rescue nil))
|
||||
for experience in @experiences
|
||||
xml.item do
|
||||
xml.title(experience.beer.title)
|
||||
xml.description(experience.beer.brewery.title)
|
||||
xml.author(experience.beer.page.created_by.title)
|
||||
xml.pubDate(experience.created_at.strftime("%a, %d %b %Y %H:%M:%S %z"))
|
||||
xml.link(beer_url(experience.beer.page.title_for_url))
|
||||
xml.guid(beer_url(experience.beer.page.title_for_url))
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
|
@ -11,6 +11,7 @@
|
|||
<style type="text/css">
|
||||
<%= yield :stylesheet %>
|
||||
</style>
|
||||
<%= yield :auto_discoveries %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
xml.instruct! :xml, :version=>"1.0"
|
||||
xml.rss(:version=>"2.0"){
|
||||
xml.channel{
|
||||
xml.title("BarleySodas Recently Updated Pages")
|
||||
xml.link(pages_url)
|
||||
xml.description("The most recently updated pages in BarleySodas.")
|
||||
xml.lastBuildDate((@pages.first.created_at.strftime("%a, %d %b %Y %H:%M:%S %z") rescue nil))
|
||||
xml.language('en-us')
|
||||
for page in @pages
|
||||
xml.item do
|
||||
xml.title(page.title)
|
||||
xml.description(page.title)
|
||||
xml.author(page.created_by.title)
|
||||
xml.pubDate(page.created_at.strftime("%a, %d %b %Y %H:%M:%S %z"))
|
||||
xml.link(page_url(page.title_for_url))
|
||||
xml.guid(page_url(page.title_for_url))
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
|
@ -14,3 +14,7 @@
|
|||
<%= new_page_link -%><br />
|
||||
<%= render :partial => 'shared/tag_cloud' %>
|
||||
<% end -%>
|
||||
|
||||
<% content_for :auto_discoveries do -%>
|
||||
<%= auto_discovery_link_tag :rss, { :format => :rss } %>
|
||||
<% end -%>
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
xml.instruct! :xml, :version=>"1.0"
|
||||
xml.rss(:version=>"2.0"){
|
||||
xml.channel{
|
||||
xml.title("BarleySodas Newest People")
|
||||
xml.link(peoples_url)
|
||||
xml.description("The newest people added into BarleySodas.")
|
||||
xml.lastBuildDate((@peoples.first.created_at.strftime("%a, %d %b %Y %H:%M:%S %z") rescue nil))
|
||||
xml.language('en-us')
|
||||
for people in @peoples
|
||||
xml.item do
|
||||
xml.title(people.title)
|
||||
xml.description(people.title)
|
||||
xml.pubDate(people.created_at.strftime("%a, %d %b %Y %H:%M:%S %z"))
|
||||
xml.link(people_url(people.page.title_for_url))
|
||||
xml.guid(people_url(people.page.title_for_url))
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
|
@ -8,3 +8,7 @@
|
|||
<%= new_people_link %><br />
|
||||
<%= render :partial => 'shared/tag_cloud' %>
|
||||
<% end -%>
|
||||
|
||||
<% content_for :auto_discoveries do -%>
|
||||
<%= auto_discovery_link_tag :rss, { :format => :rss } %>
|
||||
<% end -%>
|
|
@ -8,6 +8,7 @@ class CreateBreweries < ActiveRecord::Migration
|
|||
t.column :state, :string
|
||||
t.column :postal_code, :string
|
||||
t.column :country, :string
|
||||
t.column :homepage, :string
|
||||
t.column :created_at, :timestamp
|
||||
end
|
||||
add_column :beers, :brewery_id, :integer
|
||||
|
|
Reference in New Issue