Merge pull request #105 from enmasse-entertainment/rails31-compatability-fixes

Rails31 compatability fixes
This commit is contained in:
Philip Arndt 2011-07-28 17:49:47 -07:00
commit f0c2eb9867
7 changed files with 61 additions and 22 deletions

View file

@ -3,7 +3,7 @@
<% content_for :body_content_left do %>
<% if @blog_posts.any? %>
<section id="blog_posts">
<%= render :partial => "/blog/shared/post", :collection => @blog_posts %>
<%= render :partial => "/refinery/blog/shared/post", :collection => @blog_posts %>
<%= paginate @blog_posts %>
</section>
<% else %>
@ -14,8 +14,8 @@
<% end %>
<% content_for :body_content_right do %>
<%= render :partial => "/blog/shared/categories" %>
<%= render :partial => "/refinery/blog/shared/categories" %>
<% end %>
<%= render :partial => "/shared/content_page" %>
<%= render :partial => "/refinery/content_page" %>
<% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %>

View file

@ -15,7 +15,7 @@
<aside class='filed_in'>
<%= t('filed_in', :scope => 'refinery.blog.posts.show') %>
<% categories.each_with_index do |category, index| %>
<%= link_to category.title, blog_category_url(category) -%><%= ',' if index < ((categories.length) - 1) %>
<%= link_to category.title, main_app.blog_category_path(category) -%><%= ',' if index < ((categories.length) - 1) %>
<% end %>
</aside>
<% end %>

View file

@ -1,9 +1,9 @@
<% content_for :body_content_left do %>
<%=raw @page[Page.default_parts.first.to_sym] if Page.default_parts.any? %>
<%=raw @page[::Refinery::Page.default_parts.first.to_sym] if ::Refinery::Page.default_parts.any? %>
<% if @blog_posts.any? %>
<section id="blog_posts">
<%= render :partial => "/blog/shared/post", :collection => @blog_posts %>
<%= render :partial => "/refinery/blog/shared/post", :collection => @blog_posts %>
<%= paginate @blog_posts %>
</section>
<% else %>
@ -12,13 +12,13 @@
<% end %>
<% content_for :body_content_right do %>
<%=raw @page[Page.default_parts.second.to_sym] if Page.default_parts.many? %>
<%=raw @page[::Refinery::Page.default_parts.second.to_sym] if ::Refinery::Page.default_parts.many? %>
<%= render :partial => "/blog/shared/categories" %>
<%= render :partial => "/blog/shared/tags" %>
<%= render :partial => "/blog/shared/rss_feed" %>
<%= render :partial => "/refinery/blog/shared/categories" %>
<%= render :partial => "/refinery/blog/shared/tags" %>
<%= render :partial => "/refinery/blog/shared/rss_feed" %>
<%= blog_archive_list %>
<% end %>
<%= render :partial => "/shared/content_page" %>
<%= render :partial => "/refinery/content_page" %>
<% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %>

View file

@ -1,16 +1,16 @@
xml.instruct! :xml, :version => "1.0"
xml.rss :version => "2.0" do
xml.channel do
xml.title RefinerySetting.find_or_set(:site_name, "Company Name")
xml.description RefinerySetting.find_or_set(:site_name, "Company Name") + " Blog Posts"
xml.link blog_root_url
xml.title ::Refinery::Setting.find_or_set(:site_name, "Company Name")
xml.description ::Refinery::Setting.find_or_set(:site_name, "Company Name") + " Blog Posts"
xml.link main_app.blog_root_url
@blog_posts.each do |post|
xml.item do
xml.title post.title
xml.description post.body
xml.pubDate post.published_at.to_s(:rfc822)
xml.link blog_post_url(post)
xml.link main_app.blog_post_url(post)
end
end
end

View file

@ -4,18 +4,18 @@
<h1><%= link_to post.title, main_app.blog_post_path(post) %></h1>
<section class='details'>
<time datetime="<%=l post.published_at.to_date, :format => :default %>" class='posted_at'>
<%= t('created_at', :scope => 'blog.shared.posts', :when => l(post.published_at.to_date, :format => :short)) %>
<%= t('created_at', :scope => 'refinery.blog.shared.posts', :when => l(post.published_at.to_date, :format => :short)) %>
</time>
<%= "#{t('by', :scope => 'blog.posts.show')} #{post.author.username}" if post.author.present? %>.
<%= "#{t('by', :scope => 'refinery.blog.posts.show')} #{post.author.username}" if post.author.present? %>.
<% if (categories = post.categories).any? %>
<aside class='filed_in'>
<%= t('filed_in', :scope => 'blog.posts.show') %>
<%= t('filed_in', :scope => 'refinery.blog.posts.show') %>
<%=raw categories.collect { |category| link_to category.title, main_app.blog_category_path(category) }.to_sentence %>
</aside>
<% end %>
<% if (tags = post.tags).any? %>
<aside class='tagged'>
<%= t('tagged', :scope => 'blog.posts.show') %>
<%= t('tagged', :scope => 'refinery.blog.posts.show') %>
<%=raw tags.collect { |tag| link_to tag, main_app.tagged_posts_path(tag.id, tag.name.parameterize) }.to_sentence %>
</aside>
<% end %>
@ -30,14 +30,14 @@
</section>
<footer>
<p>
<%= link_to t('read_more', :scope => 'blog.shared.posts'), main_app.blog_post_path(post) if blog_post_teaser_enabled? %>
<%= link_to t('read_more', :scope => 'refinery.blog.shared.posts'), main_app.blog_post_path(post) if blog_post_teaser_enabled? %>
</p>
<aside class='comment_count'>
<% if Refinery::BlogPost.comments_allowed? %>
<% if post.comments.any? %>
(<%= pluralize(post.comments.approved.count, t('singular', :scope => 'blog.shared.comments')) %>)
(<%= pluralize(post.comments.approved.count, t('singular', :scope => 'refinery.blog.shared.comments')) %>)
<% else %>
(<%= t('none', :scope => 'blog.shared.comments') %>)
(<%= t('none', :scope => 'refinery.blog.shared.comments') %>)
<% end %>
<% end %>
</aside>

View file

@ -0,0 +1,19 @@
require "spec_helper"
describe "blog categories" do
before(:each) do
@blog_post = Factory(:blog_post, :title => "Refinery CMS blog post")
@blog_category = Factory(:blog_category, :title => "Video Games")
@blog_post.categories << @blog_category
@blog_post.save!
end
context "has posts" do
it "displays category's blog posts" do
visit blog_category_path(@blog_category)
page.should have_content("Refinery CMS blog post")
page.should have_content("Video Games")
end
end
end

View file

@ -0,0 +1,20 @@
require "spec_helper"
describe "blog" do
it "displays the blog rss feed" do
get blog_rss_feed_path
response.should be_success
response.content_type.should eq("application/rss+xml")
end
describe "posts" do
let!(:blog_post) { Factory(:blog_post, :title => "Refinery CMS blog post") }
context "has blog posts" do
it "Displays blog post" do
visit blog_post_path(blog_post)
page.should have_content("Refinery CMS blog post")
end
end
end
end