Fixed namespacing for Refinery conventions.

This commit is contained in:
Philip Arndt 2012-01-17 16:56:03 +13:00
parent b3a25c1b68
commit b1e4fd0094
62 changed files with 259 additions and 282 deletions

View file

@ -2,7 +2,13 @@ source "http://rubygems.org"
gemspec
gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git'
git 'git://github.com/resolve/refinerycms.git' do
gem 'refinerycms'
group :development, :test do
gem 'refinerycms-testing'
end
end
group :development, :test do
require 'rbconfig'

View file

@ -14,6 +14,6 @@ end
require "refinerycms-testing"
Refinery::Testing::Railtie.load_tasks
#Refinery::Testing::Railtie.load_dummy_tasks(ENGINE_PATH)
Refinery::Testing::Railtie.load_dummy_tasks(ENGINE_PATH)
load File.expand_path('../tasks/rspec.rake', __FILE__)

View file

@ -10,20 +10,20 @@ module Refinery
:order => 'published_at DESC'
def index
@blog_comments = Refinery::Blog::Comment.unmoderated.page(params[:page])
@comments = Refinery::Blog::Comment.unmoderated.page(params[:page])
render :action => 'index'
end
def approved
unless params[:id].present?
@blog_comments = Refinery::Blog::Comment.approved.page(params[:page])
@comments = Refinery::Blog::Comment.approved.page(params[:page])
render :action => 'index'
else
@blog_comment = Refinery::Blog::Comment.find(params[:id])
@blog_comment.approve!
flash[:notice] = t('approved', :scope => 'refinery.admin.blog.comments', :author => @blog_comment.name)
@comment = Refinery::Blog::Comment.find(params[:id])
@comment.approve!
flash[:notice] = t('approved', :scope => 'refinery.blog.admin.comments', :author => @comment.name)
redirect_to main_app.url_for(:action => params[:return_to] || 'index')
end
@ -31,13 +31,13 @@ module Refinery
def rejected
unless params[:id].present?
@blog_comments = Refinery::Blog::Comment.rejected.page(params[:page])
@comments = Refinery::Blog::Comment.rejected.page(params[:page])
render :action => 'index'
else
@blog_comment = Refinery::Blog::Comment.find(params[:id])
@blog_comment.reject!
flash[:notice] = t('rejected', :scope => 'refinery.admin.blog.comments', :author => @blog_comment.name)
@comment = Refinery::Blog::Comment.find(params[:id])
@comment.reject!
flash[:notice] = t('rejected', :scope => 'refinery.blog.admin.comments', :author => @comment.name)
redirect_to main_app.url_for(:action => params[:return_to] || 'index')
end

View file

@ -16,7 +16,7 @@ module Refinery
before_filter :check_category_ids, :only => :update
def uncategorized
@blog_posts = Refinery::Blog::Post.uncategorized.page(params[:page])
@posts = Refinery::Blog::Post.uncategorized.page(params[:page])
end
def tags
@ -35,21 +35,21 @@ module Refinery
end
def new
@blog_post = ::Refinery::Blog::Post.new(:author => current_refinery_user)
@post = ::Refinery::Blog::Post.new(:author => current_refinery_user)
end
def create
# if the position field exists, set this object as last object, given the conditions of this class.
if Refinery::Blog::Post.column_names.include?("position")
params[:blog_post].merge!({
params[:post].merge!({
:position => ((Refinery::Blog::Post.maximum(:position, :conditions => "")||-1) + 1)
})
end
if (@blog_post = Refinery::Blog::Post.create(params[:blog_post])).valid?
if (@post = Refinery::Blog::Post.create(params[:post])).valid?
(request.xhr? ? flash.now : flash).notice = t(
'refinery.crudify.created',
:what => "'#{@blog_post.title}'"
:what => "'#{@post.title}'"
)
unless from_dialog?
@ -63,7 +63,7 @@ module Refinery
end
end
else
render :text => "<script>parent.window.location = '#{admin_blog_posts_url}';</script>"
render :text => "<script>parent.window.location = '#{refinery_blog_admin_posts_url}';</script>"
end
else
unless request.xhr?
@ -71,7 +71,7 @@ module Refinery
else
render :partial => "/refinery/admin/error_messages",
:locals => {
:object => @blog_post,
:object => @post,
:include_object_name => true
}
end
@ -80,11 +80,11 @@ module Refinery
protected
def find_all_categories
@blog_categories = Refinery::Blog::Category.find(:all)
@categories = Refinery::Blog::Category.find(:all)
end
def check_category_ids
params[:blog_post][:category_ids] ||= []
params[:post][:category_ids] ||= []
end
end
end

View file

@ -11,9 +11,9 @@ module Refinery
flash[:notice] = t('updated', :scope => 'admin.blog.settings.notification_recipients',
:recipients => Refinery::Blog::Comment::Notification.recipients)
unless request.xhr? or from_dialog?
redirect_back_or_default(admin_blog_posts_path)
redirect_back_or_default(refinery_blog_admin_posts_path)
else
render :text => "<script type='text/javascript'>parent.window.location = '#{admin_blog_posts_path}';</script>",
render :text => "<script type='text/javascript'>parent.window.location = '#{refinery_blog_admin_posts_path}';</script>",
:layout => false
end
end
@ -22,7 +22,7 @@ module Refinery
def moderation
enabled = Refinery::Blog::Comment::Moderation.toggle!
unless request.xhr?
redirect_back_or_default(admin_blog_posts_path)
redirect_back_or_default(refinery_blog_admin_posts_path)
else
render :json => {:enabled => enabled},
:layout => false
@ -32,7 +32,7 @@ module Refinery
def comments
enabled = Refinery::Blog::Comment.toggle!
unless request.xhr?
redirect_back_or_default(admin_blog_posts_path)
redirect_back_or_default(refinery_blog_admin_posts_path)
else
render :json => {:enabled => enabled},
:layout => false
@ -42,7 +42,7 @@ module Refinery
def teasers
enabled = Refinery::Blog::Post.teaser_enabled_toggle!
unless request.xhr?
redirect_back_or_default(admin_blog_posts_path)
redirect_back_or_default(refinery_blog_admin_posts_path)
else
render :json => {:enabled => enabled},
:layout => false

View file

@ -1,6 +1,6 @@
module Refinery
module Blog
class BaseController < ::ApplicationController
class BlogController < ::ApplicationController
include ControllerHelper

View file

@ -1,10 +1,10 @@
module Refinery
module Blog
class CategoriesController < BaseController
class CategoriesController < BlogController
def show
@blog_category = Refinery::Blog::Category.find(params[:id])
@blog_posts = @blog_category.posts.live.includes(:comments, :categories).page(params[:page])
@category = Refinery::Blog::Category.find(params[:id])
@posts = @category.posts.live.includes(:comments, :categories).page(params[:page])
end
end

View file

@ -1,6 +1,6 @@
module Refinery
module Blog
class PostsController < BaseController
class PostsController < BlogController
caches_page :index
@ -12,41 +12,41 @@ module Refinery
def index
# Rss feeders are greedy. Let's give them every blog post instead of paginating.
(@blog_posts = Refinery::Blog::Post.live.includes(:comments, :categories).all) if request.format.rss?
respond_with (@blog_posts) do |format|
(@posts = Post.live.includes(:comments, :categories).all) if request.format.rss?
respond_with (@posts) do |format|
format.html
format.rss
end
end
def show
@blog_comment = Refinery::Blog::Comment.new
@comment = Comment.new
@canonical = url_for(:locale => ::Refinery::I18n.default_frontend_locale) if canonical?
respond_with (@blog_post) do |format|
format.html { present(@blog_post) }
respond_with (@post) do |format|
format.html { present(@post) }
format.js { render :partial => 'post', :layout => false }
end
end
def comment
if (@blog_comment = @blog_post.comments.create(params[:blog_comment])).valid?
if Refinery::Blog::Comment::Moderation.enabled? or @blog_comment.ham?
if (@comment = @post.comments.create(params[comment])).valid?
if Comment::Moderation.enabled? or @comment.ham?
begin
Refinery::Blog::CommentMailer.notification(@blog_comment, request).deliver
CommentMailer.notification(@comment, request).deliver
rescue
logger.warn "There was an error delivering a blog comment notification.\n#{$!}\n"
end
end
if Refinery::Blog::Comment::Moderation.enabled?
if Comment::Moderation.enabled?
flash[:notice] = t('thank_you_moderated', :scope => 'refinery.blog.posts.comments')
redirect_to main_app.blog_post_url(params[:id])
redirect_to main_app.refinery_blog_post_url(params[:id])
else
flash[:notice] = t('thank_you', :scope => 'refinery.blog.posts.comments')
redirect_to main_app.blog_post_url(params[:id],
:anchor => "comment-#{@blog_comment.to_param}")
redirect_to main_app.refinery_blog_post_url(params[:id],
:anchor => "comment-#{@comment.to_param}")
end
else
render :action => 'show'
@ -58,20 +58,20 @@ module Refinery
date = "#{params[:month]}/#{params[:year]}"
@archive_date = Time.parse(date)
@date_title = @archive_date.strftime('%B %Y')
@blog_posts = Refinery::Blog::Post.live.by_archive(@archive_date).page(params[:page])
@posts = Post.live.by_archive(@archive_date).page(params[:page])
else
date = "01/#{params[:year]}"
@archive_date = Time.parse(date)
@date_title = @archive_date.strftime('%Y')
@blog_posts = Refinery::Blog::Post.live.by_year(@archive_date).page(params[:page])
@posts = Post.live.by_year(@archive_date).page(params[:page])
end
respond_with (@blog_posts)
respond_with (@posts)
end
def tagged
@tag = ActsAsTaggableOn::Tag.find(params[:tag_id])
@tag_name = @tag.name
@blog_posts = Refinery::Blog::Post.tagged_with(@tag_name).page(params[:page])
@posts = Post.tagged_with(@tag_name).page(params[:page])
end
def canonical?

View file

@ -5,9 +5,9 @@ module Refinery
protected
def find_blog_post
unless (@blog_post = Refinery::Blog::Post.find(params[:id])).try(:live?)
unless (@post = Refinery::Blog::Post.find(params[:id])).try(:live?)
if refinery_user? and current_refinery_user.authorized_plugins.include?("refinerycms_blog")
@blog_post = Refinery::Blog::Post.find(params[:id])
@post = Refinery::Blog::Post.find(params[:id])
else
error_404
end
@ -15,15 +15,14 @@ module Refinery
end
def find_all_blog_posts
@blog_posts = Refinery::Blog::Post.live.includes(:comments, :categories).page(params[:page])
@posts = Refinery::Blog::Post.live.includes(:comments, :categories).page(params[:page])
end
def find_tags
@tags = Refinery::Blog::Post.tag_counts_on(:tags)
end
def find_all_blog_categories
@blog_categories = Refinery::Blog::Category.all
@categories = Refinery::Blog::Category.all
end
end
end

View file

@ -3,7 +3,7 @@ module Refinery
class CommentMailer < ActionMailer::Base
def notification(comment, request)
@blog_comment = comment
@comment = comment
mail :subject => Blog::Comment::Notification.subject,
:recipients => Blog::Comment::Notification.recipients,
:from => "\"#{Refinery::Core.config.site_name}\" <no-reply@#{request.domain}>"

View file

@ -1,4 +1,4 @@
<%= form_for [main_app, :refinery_admin, @blog_category] do |f| -%>
<%= form_for [main_app, :refinery_admin, @category] do |f| -%>
<%= render :partial => "/refinery/admin/error_messages",
:locals => {
:object => f.object,
@ -14,6 +14,6 @@
:locals => {
:f => f,
:continue_editing => false,
:delete_title => t('delete', :scope => 'refinery.admin.blog.categories.category')
:delete_title => t('delete', :scope => 'refinery.blog.admin.categories.category')
} %>
<% end %>

View file

@ -1,5 +1,5 @@
<ul id='sortable_list'>
<%= render :partial => 'category', :collection => @blog_categories %>
<%= render :partial => 'category', :collection => @categories %>
</ul>
<%= render :partial => "/refinery/admin/sortable_list",
:locals => {

View file

@ -1,25 +1,25 @@
<%= render :partial => '/refinery/admin/blog/submenu' %>
<%= render :partial => '/refinery/blog/admin/submenu' %>
<div id='records'>
<% if searching? %>
<h2><%= t('results_for', :scope => 'refinery.admin.search',
:query => params[:search]) %></h2>
<% if @blog_categories.any? %>
<% if @categories.any? %>
<%= render :partial => "blog_categories",
:collection => @blog_categories %>
:collection => @categories %>
<% else %>
<p><%= t('no_results', :scope => 'refinery.admin.search') %></p>
<% end %>
<% else %>
<% if @blog_categories.any? %>
<%= will_paginate @blog_categories %>
<% if @categories.any? %>
<%= will_paginate @categories %>
<%= render :partial => "sortable_list" %>
<%= will_paginate @blog_categories %>
<%= will_paginate @categories %>
<% else %>
<p>
<strong>
<%= t('.no_items_yet', :create => t('new', :scope => 'refinery.admin.blog.submenu.categories')) %>
<%= t('.no_items_yet', :create => t('new', :scope => 'refinery.blog.admin.submenu.categories')) %>
</strong>
</p>
<% end %>

View file

@ -5,7 +5,7 @@
</span>
<span class='actions'>
<%= link_to refinery_icon_tag("application_go.png"),
main_app.blog_post_path(comment.post, :anchor => "comment-#{comment.to_param}"),
main_app.refinery_blog_post_path(comment.post, :anchor => "comment-#{comment.to_param}"),
:title => t('.view_live_html'),
:target => "_blank" unless comment.unmoderated? %>
<%= link_to refinery_icon_tag('zoom.png'), main_app.refinery_blog_admin_comment_path(comment),

View file

@ -1,5 +1,5 @@
<ul id='sortable_list'>
<%= render :partial => 'comment', :collection => @blog_comments %>
<%= render :partial => 'comment', :collection => @comments %>
</ul>
<%= render :partial => "/refinery/admin/sortable_list",
:locals => {

View file

@ -1,26 +1,26 @@
<%= render :partial => '/refinery/admin/blog/submenu' %>
<%= render :partial => '/refinery/blog/admin/submenu' %>
<div id='records'>
<% if searching? %>
<h2><%= t('results_for', :scope => 'shared.admin.search', :query => params[:search]) %></h2>
<% if @blog_comments.any? %>
<%= will_paginate @blog_comments %>
<% if @comments.any? %>
<%= will_paginate @comments %>
<ul>
<%= render :partial => "blog_comments",
:collection => @blog_comments %>
:collection => @comments %>
</ul>
<%= will_paginate @blog_comments %>
<%= will_paginate @comments %>
<% else %>
<p><%= t('search_no_results', :scope => 'admin') %></p>
<% end %>
<% else %>
<% if @blog_comments.any? %>
<%= will_paginate @blog_comments %>
<% if @comments.any? %>
<%= will_paginate @comments %>
<%= render :partial => "sortable_list" %>
<%= will_paginate @blog_comments %>
<%= will_paginate @comments %>
<% else %>
<h3>
<%= t('.no_items_yet',

View file

@ -1,7 +1,7 @@
<div id='actions'>
<h2><%= t('.details')%></h2>
<p>
<strong><%= t('.age') %>:</strong> <%= time_ago_in_words(@blog_comment.created_at) %>
<strong><%= t('.age') %>:</strong> <%= time_ago_in_words(@comment.created_at) %>
</p>
<h2><%= t('.actions') %></h2>
<ul>
@ -9,12 +9,12 @@
<%= link_to t('.back'), main_app.refinery_blog_admin_comments_path, :class => "back_icon" %>
</li>
<li>
<%= link_to t('.reject'), main_app.rejected_refinery_blog_admin_comment_path(@blog_comment, :return_to => 'rejected'),
:class => 'comment_cross_icon' unless @blog_comment.rejected? %>
<%= link_to t('.reject'), main_app.rejected_refinery_blog_admin_comment_path(@comment, :return_to => 'rejected'),
:class => 'comment_cross_icon' unless @comment.rejected? %>
</li>
<li>
<%= link_to t('.approve'), main_app.approved_refinery_blog_admin_comment_path(@blog_comment, :return_to => 'approved'),
:class => 'comment_tick_icon' unless @blog_comment.approved? %>
<%= link_to t('.approve'), main_app.approved_refinery_blog_admin_comment_path(@comment, :return_to => 'approved'),
:class => 'comment_tick_icon' unless @comment.approved? %>
</li>
</ul>
</div>
@ -26,8 +26,8 @@
<strong><%= t('.blog_post') %></strong>
</td>
<td>
<%= link_to @blog_comment.post.title,
main_app.blog_post_path(@blog_comment.post, :anchor => "comment-#{@blog_comment.to_param}"),
<%= link_to @comment.post.title,
main_app.refinery_blog_post_path(@comment.post, :anchor => "comment-#{@comment.to_param}"),
:target => '_blank' %>
</td>
</tr>
@ -36,7 +36,7 @@
<strong><%= t('.from') %></strong>
</td>
<td>
<%= @blog_comment.name %> [<%= mail_to @blog_comment.email, @blog_comment.email, {:title => t('.click_to_email')} %>]
<%= @comment.name %> [<%= mail_to @comment.email, @comment.email, {:title => t('.click_to_email')} %>]
</td>
</tr>
<tr>
@ -44,7 +44,7 @@
<strong><%= t('.date') %></strong>
</td>
<td>
<%= l(Date.parse(@blog_comment.created_at.to_s), :format => :long) %>
<%= l(Date.parse(@comment.created_at.to_s), :format => :long) %>
</td>
</tr>
<tr>
@ -53,7 +53,7 @@
</td>
<td>
<p style='margin-top: 0px'>
<%= @blog_comment.message.gsub("\r\n\r\n", "\r\n").gsub("\r\n", "</p><p>") %>
<%= @comment.message.gsub("\r\n\r\n", "\r\n").gsub("\r\n", "</p><p>") %>
</p>
</td>
</tr>

View file

@ -1,4 +1,4 @@
<%= form_for [main_app, :refinery_admin, @blog_post] do |f| -%>
<%= form_for [main_app, :refinery_blog_admin, @post] do |f| -%>
<%= render :partial => "/refinery/admin/error_messages",
:locals => {
:object => f.object,
@ -28,19 +28,11 @@
<div id='page_part_editors'>
<% part_index = -1 %>
<%= render :partial => 'form_part',
:locals => {
:f => f,
:part_index => (part_index += 1),
} -%>
<%= render :partial => 'teaser_part',
:locals => {
:f => f,
:part_index => (part_index += 1),
} if f.object.respond_to?(:custom_teaser) -%>
<%= render 'form_part', :f => f, :part_index => (part_index += 1) -%>
<%= render 'teaser_part', :f => f, :part_index => (part_index += 1) if f.object.respond_to?(:custom_teaser) -%>
<% Refinery::Blog.tabs.each_with_index do |tab, tab_index| %>
<div class='page_part' id='<%= "custom_tab_#{tab_index}" %>'>
<%= render :partial => tab.partial, :locals => {:f => f} %>
<%= render tab.partial, :f => f %>
</div>
<% end %>
</div>
@ -65,14 +57,14 @@
</div>
<div id='more_options' style="display:none;">
<div class="hemisquare">
<h3><%= t('title', :scope => 'refinery.admin.blog.submenu.categories') %></h3>
<h3><%= t('title', :scope => 'refinery.blog.admin.submenu.categories') %></h3>
<ul class='blog_categories'>
<% @blog_categories.each do |category| %>
<% @categories.each do |category| %>
<li>
<%= check_box_tag 'blog_post[category_ids][]', category.id,
@blog_post.categories.include?(category),
:id => (id="blog_post_category_ids_#{category.id}") %>
<%= label_tag 'blog_post[category_ids][]', category.title,
<%= check_box_tag 'post[category_ids][]', category.id,
@post.categories.include?(category),
:id => (id="post_category_ids_#{category.id}") %>
<%= label_tag 'post[category_ids][]', category.title,
:class => 'stripped',
:for => id %>
</li>
@ -100,14 +92,14 @@
</div>
<div class='hemisquare right_side'>
<%= render :partial => '/seo_meta/form', :locals => {:form => f} %>
<%= render '/seo_meta/form', :form => f %>
</div>
</div>
<%= render :partial => "/refinery/admin/form_actions",
:locals => {
:f => f,
:continue_editing => true,
:delete_title => t('delete', :scope => 'refinery.admin.blog.posts.post')
:delete_title => t('delete', :scope => 'refinery.blog.admin.posts.post')
} %>
<% end -%>

View file

@ -7,7 +7,7 @@
</span>
</span>
<span class='actions'>
<%= link_to refinery_icon_tag("application_go.png"), main_app.blog_post_path(post),
<%= link_to refinery_icon_tag("application_go.png"), main_app.refinery_blog_post_path(post),
:title => t('.view_live_html'),
:target => "_blank" %>
<%= link_to refinery_icon_tag("application_edit.png"), main_app.edit_refinery_blog_admin_post_path(post),

View file

@ -1,5 +1,5 @@
<ul id='sortable_list'>
<%= render :partial => 'post', :collection => @blog_posts %>
<%= render :partial => 'post', :collection => @posts %>
</ul>
<%= render :partial => "/refinery/admin/sortable_list",
:locals => {

View file

@ -2,9 +2,9 @@
<%= f.text_area :custom_teaser, :rows => 20, :class => 'wymeditor widest' -%>
<p>
<span class='clearfix label_inline_with_link'>
<%= link_to t('copy_body', :scope => 'refinery.admin.blog.posts.form'), "#",
<%= link_to t('copy_body', :scope => 'refinery.blog.admin.posts.form'), "#",
:id => 'copy_body_link',
:title => t('copy_body_help', :scope => 'refinery.admin.blog.posts.form') %>
:title => t('copy_body_help', :scope => 'refinery.blog.admin.posts.form') %>
</span>
</p>
</div>

View file

@ -1,26 +1,26 @@
<%= render :partial => '/refinery/admin/blog/submenu' %>
<%= render :partial => '/refinery/blog/admin/submenu' %>
<div id='records'>
<% if searching? %>
<h2><%= t('results_for', :scope => 'refinery.admin.search', :query => params[:search]) %></h2>
<% if @blog_posts.any? %>
<% if @posts.any? %>
<ul>
<%= render :partial => "post",
:collection => @blog_posts %>
:collection => @posts %>
</ul>
<% else %>
<p><%= t('no_results', :scope => 'refinery.admin.search') %></p>
<% end %>
<% else %>
<% if @blog_posts.any? %>
<%= will_paginate @blog_posts %>
<% if @posts.any? %>
<%= will_paginate @posts %>
<%= render :partial => "sortable_list" %>
<%= will_paginate @blog_posts %>
<%= will_paginate @posts %>
<% else %>
<p>
<strong>
<%= t('.no_items_yet', :create => t('new', :scope => 'refinery.admin.blog.submenu.posts')) %>
<%= t('.no_items_yet', :create => t('new', :scope => 'refinery.blog.admin.submenu.posts')) %>
</strong>
</p>
<% end %>

View file

@ -1,21 +1,21 @@
<%= render :partial => '/refinery/admin/blog/submenu' %>
<%= render :partial => '/refinery/blog/admin/submenu' %>
<div id='records'>
<% if searching? %>
<h2><%= t('results_for', :scope => 'refinery.admin.search',
:query => params[:search]) %></h2>
<% if @blog_posts.any? %>
<% if @posts.any? %>
<%= render :partial => "blog_posts",
:collection => @blog_posts %>
:collection => @posts %>
<% else %>
<p><%= t('no_results', :scope => 'refinery.admin.search') %></p>
<% end %>
<% else %>
<% if @blog_posts.any? %>
<%= will_paginate @blog_posts %>
<% if @posts.any? %>
<%= will_paginate @posts %>
<%= render :partial => "sortable_list" %>
<%= will_paginate @blog_posts %>
<%= will_paginate @posts %>
<% else %>
<p>
<strong>

View file

@ -18,7 +18,7 @@
:locals => {
:f => nil,
:continue_editing => false,
:cancel_url => admin_blog_posts_url,
:cancel_url => refinery_blog_admin_posts_url,
:hide_delete => true
} %>
<% end %>

View file

@ -1,10 +1,10 @@
<% content_for :body_content_title, @blog_category.title %>
<% content_for :body_content_title, @category.title %>
<% content_for :body_content_left do %>
<% if @blog_posts.any? %>
<% if @posts.any? %>
<section id="blog_posts">
<%= render :partial => "/refinery/blog/shared/post", :collection => @blog_posts %>
<%= will_paginate @blog_posts %>
<%= render :partial => "/refinery/blog/shared/post", :collection => @posts %>
<%= will_paginate @posts %>
</section>
<% else %>
<p>

View file

@ -4,10 +4,10 @@
<%=raw t('.comment_starts') %>
<%=raw t('.from') %>: <%= @blog_comment.name %>
<%=raw t('.email') %>: <%= @blog_comment.email %>
<%=raw t('.from') %>: <%= @comment.name %>
<%=raw t('.email') %>: <%= @comment.email %>
<%=raw t('.message') %>:
<%=simple_format strip_tags(@blog_comment.body) %>
<%=simple_format strip_tags(@comment.body) %>
<%=raw t('.comment_ends') %>

View file

@ -1,6 +1,6 @@
<aside id="comments">
<h2><%= t('title', :scope => 'refinery.blog.posts.show.comments') %></h2>
<% if (comments = @blog_post.comments.approved).any? %>
<% if (comments = @post.comments.approved).any? %>
<%= render :partial => "comment", :collection => comments %>
<% else %>
<p>
@ -15,7 +15,7 @@
<% end %>
<h2><%= t('add', :scope => 'refinery.blog.posts.show.comments') %></h2>
<%= form_for [main_app, :blog_post, @blog_comment] do |f| %>
<%= form_for [main_app, :refinery_blog, @comment] do |f| %>
<%= render :partial => "/refinery/admin/error_messages",
:locals => {
:object => f.object,

View file

@ -1,17 +1,17 @@
<nav id="next_prev_article">
<% if @blog_post.next.present? -%>
<%= link_to (truncate(@blog_post.next.title) + " &#187;").html_safe,
main_app.url_for(@blog_post.next),
<% if @post.next.present? -%>
<%= link_to (truncate(@post.next.title) + " &#187;").html_safe,
main_app.url_for(@post.next),
:class => 'next' %>
<% end -%>
<%= link_to t('blog_home', :scope => 'refinery.blog.posts.show'),
main_app.blog_root_path,
main_app.refinery_blog_root_path,
:class => 'home' %>
<% if @blog_post.prev.present? -%>
<%= link_to ("&#171; " + truncate(@blog_post.prev.title)).html_safe,
main_app.url_for(@blog_post.prev),
<% if @post.prev.present? -%>
<%= link_to ("&#171; " + truncate(@post.prev.title)).html_safe,
main_app.url_for(@post.prev),
:class => 'prev' %>
<% end -%>
</nav><!-- /next_prev_article -->

View file

@ -5,27 +5,27 @@
<% end %>
<article id="blog_post">
<header>
<h1><%= @blog_post.title %></h1>
<h1><%= @post.title %></h1>
<section class='details'>
<time datetime="<%=l @blog_post.published_at.to_date, :format => :default %>" class='posted_at'>
<%= t('created_at', :scope => 'refinery.blog.shared.posts', :when => l(@blog_post.published_at.to_date, :format => :short)) %>
<time datetime="<%=l @post.published_at.to_date, :format => :default %>" class='posted_at'>
<%= t('created_at', :scope => 'refinery.blog.shared.posts', :when => l(@post.published_at.to_date, :format => :short)) %>
</time>
<%= "#{t('by', :scope => 'refinery.blog.posts.show')} #{@blog_post.author.username}" if @blog_post.author.present? %>.
<% if (categories = @blog_post.categories).any? %>
<%= "#{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 => 'refinery.blog.posts.show') %>
<% categories.each_with_index do |category, index| %>
<%= link_to category.title, main_app.blog_category_path(category) -%><%= ',' if index < ((categories.length) - 1) %>
<%= link_to category.title, main_app.refinery_blog_category_path(category) -%><%= ',' if index < ((categories.length) - 1) %>
<% end %>
</aside>
<% end %>
</section>
</header>
<%= @blog_post.body.html_safe %>
<%= @post.body.html_safe %>
<% if Refinery::Blog::Post::ShareThis.enabled? %>
<span class="st_sharethis" displayText="ShareThis"></span>
<% end %>
</article>
<%= render :partial => '/refinery/draft_page_message' unless @blog_post.nil? or @blog_post.live? -%>
<%= render 'nav' if next_or_previous?(@blog_post) %>
<%= render :partial => '/refinery/draft_page_message' unless @post.nil? or @post.live? -%>
<%= render 'nav' if next_or_previous?(@post) %>

View file

@ -2,9 +2,9 @@
<% content_for :body_content_left do %>
<h1><%= t('.blog_archive_for', :date => @archive_date.strftime('%B %Y')) %></h1>
<% if @blog_posts.any? %>
<% if @posts.any? %>
<section id="blog_posts">
<%= render :partial => "/refinery/blog/shared/post", :collection => @blog_posts %>
<%= render :partial => "/refinery/blog/shared/post", :collection => @posts %>
</section>
<% else %>
<p><%= t('.no_blog_articles_posted', :date => @archive_date.strftime('%B %Y')) %></p>

View file

@ -1,10 +1,10 @@
<% content_for :body_content_left do %>
<%= raw @page.content_for(::Refinery::Pages.config.default_parts.first.to_sym) if ::Refinery::Pages.config.default_parts.any? %>
<% if @blog_posts.any? %>
<% if @posts.any? %>
<section id="blog_posts">
<%= render :partial => "/refinery/blog/shared/post", :collection => @blog_posts %>
<%= will_paginate @blog_posts %>
<%= render :partial => "/refinery/blog/shared/post", :collection => @posts %>
<%= will_paginate @posts %>
</section>
<% else %>
<p><%= t('.no_blog_articles_yet') %></p>

View file

@ -3,14 +3,14 @@ xml.rss :version => "2.0" do
xml.channel do
xml.title Refinery::Core.config.site_name
xml.description Refinery::Core.config.site_name + " Blog Posts"
xml.link main_app.blog_root_url
xml.link main_app.refinery_blog_root_url
@blog_posts.each do |post|
@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 main_app.blog_post_url(post)
xml.link main_app.refinery_blog_post_url(post)
end
end
end

View file

@ -3,10 +3,10 @@
<% content_for :body_content_title, "#{t('.posts_tagged')} &#8220;#{@tag_name.titleize}&#8221;".html_safe -%>
<% content_for :body_content_left do %>
<% if @blog_posts.any? %>
<% if @posts.any? %>
<section id="blog_posts">
<%= render :partial => "/refinery/blog/shared/post", :collection => @blog_posts %>
<%= will_paginate @blog_posts %>
<%= render :partial => "/refinery/blog/shared/post", :collection => @posts %>
<%= will_paginate @posts %>
</section>
<% else %>
<p><%= t('.no_blog_articles_yet') %></p>

View file

@ -1,9 +1,9 @@
<% if @blog_categories.any? %>
<% if @categories.any? %>
<h2><%= t('.title') %></h2>
<ul id='categories'>
<% @blog_categories.each do |category| %>
<li<%= " class='selected'" if @blog_category.present? and @blog_category.id == category.id %>>
<%= link_to "#{category.title} (#{category.post_count})", main_app.blog_category_path(category) %>
<% @categories.each do |category| %>
<li<%= " class='selected'" if @category.present? and @category.id == category.id %>>
<%= link_to "#{category.title} (#{category.post_count})", main_app.refinery_blog_category_path(category) %>
</li>
<% end %>
</ul>

View file

@ -1,7 +1,7 @@
<% if post.live? %>
<article class="blog_post" id="<%= dom_id(post) %>">
<header>
<h1><%= link_to post.title, main_app.blog_post_path(post) %></h1>
<h1><%= link_to post.title, main_app.refinery_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 => 'refinery.blog.shared.posts', :when => l(post.published_at.to_date, :format => :short)) %>
@ -10,13 +10,13 @@
<% if (categories = post.categories).any? %>
<aside class='filed_in'>
<%= t('filed_in', :scope => 'refinery.blog.posts.show') %>
<%=raw categories.collect { |category| link_to category.title, main_app.blog_category_path(category) }.to_sentence %>
<%=raw categories.collect { |category| link_to category.title, main_app.refinery_blog_category_path(category) }.to_sentence %>
</aside>
<% end %>
<% if (tags = post.tags).any? %>
<aside class='tagged'>
<%= 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 %>
<%=raw tags.collect { |tag| link_to tag, main_app.refinery_blog_tagged_posts_path(tag.id, tag.name.parameterize) }.to_sentence %>
</aside>
<% end %>
</section>
@ -30,7 +30,7 @@
</section>
<footer>
<p>
<%= link_to t('read_more', :scope => 'refinery.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.refinery_blog_post_path(post) if blog_post_teaser_enabled? %>
</p>
<aside class='comment_count'>
<% if Refinery::Blog::Post.comments_allowed? %>

View file

@ -1,9 +1,9 @@
<% if @blog_posts.many? %>
<% if @posts.many? %>
<h2><%= t('.other') %></h2>
<ul id="blog_posts">
<% @blog_posts.each do |blog_post| %>
<% @posts.each do |blog_post| %>
<li class='clearfix'>
<%= link_to blog_post.title, main_app.blog_post_path(blog_post) %>
<%= link_to blog_post.title, main_app.refinery_blog_post_path(blog_post) %>
</li>
<% end %>
</ul>

View file

@ -1,2 +1,2 @@
<h2><%= t('.title') %></h2>
<%= link_to t('.subscribe'), main_app.blog_rss_feed_path, :id => "rss_feed_subscribe"%>
<%= link_to t('.subscribe'), main_app.refinery_blog_rss_feed_path, :id => "rss_feed_subscribe"%>

View file

@ -2,7 +2,7 @@
<h2><%= t('.title') %></h2>
<nav id='tags'>
<% tag_cloud(@tags, %w(tag1 tag2 tag3 tag4)) do |tag, css_class| %>
<%= link_to tag.name, main_app.tagged_posts_path(tag.id, tag.name.parameterize), :class => css_class %>
<%= link_to tag.name, main_app.refinery_blog_tagged_posts_path(tag.id, tag.name.parameterize), :class => css_class %>
<% end %>
</nav>
<% end %>

View file

@ -3,8 +3,8 @@ bg:
plugins:
refinerycms_blog:
title: Блог
admin:
blog:
blog:
admin:
categories:
category:
edit: Редактиране на тази категория
@ -80,7 +80,6 @@ bg:
moderation: Модерация
update_notified: Получатели на уведомления
comments: Коментари
blog:
comment_mailer:
notification:
greeting: Здравейте

View file

@ -3,8 +3,8 @@ cs:
plugins:
refinerycms_blog:
title: Blog
admin:
blog:
blog:
admin:
categories:
category:
edit: Upravit kategorii
@ -76,7 +76,6 @@ cs:
moderation: Moderování
update_notified: Upravit seznam notifikovaných
comments: Komentáře
blog:
comment_mailer:
notification:
greeting: Ahoj

View file

@ -3,8 +3,8 @@ de:
plugins:
refinerycms_blog:
title: Blog
admin:
blog:
blog:
admin:
categories:
category:
edit: Diese Kategorie bearbeiten
@ -76,7 +76,6 @@ de:
moderation: Moderation
update_notified: Empfänger für Benachrichtigungen bearbeiten
comments: Kommentare
blog:
comment_mailer:
notification:
greeting: Hallo

View file

@ -3,8 +3,8 @@ en:
plugins:
refinerycms_blog:
title: Blog
admin:
blog:
blog:
admin:
categories:
category:
edit: Edit this category
@ -83,7 +83,6 @@ en:
update_notified: Update who gets notified
comments: Comments
teasers: Teasers
blog:
comment_mailer:
notification:
greeting: Hi there

View file

@ -3,8 +3,8 @@ es:
plugins:
refinerycms_blog:
title: Blog
admin:
blog:
blog:
admin:
categories:
category:
edit: Editar esta categoría
@ -76,7 +76,6 @@ es:
moderation: Moderación
update_notified: '¿Quién recibe las notificaciones?'
comments: Comentarios
blog:
comment_mailer:
notification:
greeting: Hola

View file

@ -3,8 +3,8 @@ fr:
plugins:
refinerycms_blog:
title: Blog
admin:
blog:
blog:
admin:
categories:
category:
edit: Modifier cette catégorie
@ -76,7 +76,6 @@ fr:
moderation: Modération
update_notified: Mettre à jour les personnes à notifier
comments: Commentaires
blog:
comment_mailer:
notification:
greeting: Bonjour

View file

@ -3,8 +3,8 @@ it:
plugins:
refinerycms_blog:
title: Blog
admin:
blog:
blog:
admin:
categories:
category:
edit: Modifica questa categoria
@ -80,7 +80,6 @@ it:
moderation: Moderazione
update_notified: Aggiornare i destinatari delle notifiche
comments: Commenti
blog:
comment_mailer:
notification:
greeting: Ciao

View file

@ -3,8 +3,8 @@ ja:
plugins:
refinerycms_blog:
title: ブログ
admin:
blog:
blog:
admin:
categories:
category:
edit: このカテゴリを編集
@ -80,7 +80,6 @@ ja:
moderation: 管理する
update_notified: 通知者を変更・更新する
comments: コメント
blog:
comment_mailer:
notification:
greeting: こんにちわ

View file

@ -3,8 +3,8 @@ nb:
plugins:
refinerycms_blog:
title: Blog
admin:
blog:
blog:
admin:
posts:
form:
seo_override_title: Nettleser tittel

View file

@ -3,8 +3,8 @@ nl:
plugins:
refinerycms_blog:
title: Blog
admin:
blog:
blog:
admin:
categories:
category:
edit: Bewerk deze categorie
@ -77,7 +77,6 @@ nl:
update_notified: Wijzig wie notificaties ontvangt
comments: Reacties
teasers: Teasers
blog:
comment_mailer:
notification:
greeting: Hallo

View file

@ -3,8 +3,8 @@ pl:
plugins:
refinerycms_blog:
title: Blog
admin:
blog:
blog:
admin:
categories:
category:
edit: Edytuj tą kategorię
@ -76,7 +76,6 @@ pl:
moderation: Wł./wył. moderację
update_notified: Powiadamianie przez e-mail
comments: Komentarze
blog:
comment_mailer:
notification:
greeting: Witaj:)

View file

@ -3,8 +3,8 @@ pt-BR:
plugins:
refinerycms_blog:
title: Blog
admin:
blog:
blog:
admin:
categories:
category:
edit: Editar esta categoria
@ -76,7 +76,6 @@ pt-BR:
moderation: Moderação
update_notified: Quem receberá a notificação?
comments: Comentários
blog:
comment_mailer:
notification:
greeting: Olá

View file

@ -3,8 +3,8 @@ ru:
plugins:
refinerycms_blog:
title: Блог
admin:
blog:
blog:
admin:
categories:
category:
edit: Редактировать эту категорию
@ -76,7 +76,6 @@ ru:
moderation: Модерирование
update_notified: Настроить уведомления
comments: Комментарии
blog:
comment_mailer:
notification:
greeting: Здравствуйте

View file

@ -3,8 +3,8 @@ sk:
plugins:
refinerycms_blog:
title: Blog
admin:
blog:
blog:
admin:
categories:
category:
edit: Upraviť kategóriu
@ -76,7 +76,6 @@ sk:
moderation: Moderovanie
update_notified: Upraviť zoznam notifikovaných
comments: Komentáre
blog:
comment_mailer:
notification:
greeting: Ahoj

View file

@ -3,8 +3,8 @@ zh-CN:
plugins:
refinerycms_blog:
title: 博客
admin:
blog:
blog:
admin:
categories:
category:
edit: 编辑此类别
@ -76,7 +76,6 @@ zh-CN:
moderation: 等待审核
update_notified: 更新获得通知的人
comments: 评论
blog:
comment_mailer:
notification:
greeting: 您好

View file

@ -1,16 +1,23 @@
Rails.application.routes.draw do
scope(:module => 'refinery') do
scope(:path => 'blog', :module => 'blog') do
root :to => 'posts#index', :as => 'blog_root'
match 'feed.rss', :to => 'posts#index', :as => 'blog_rss_feed', :defaults => {:format => "rss"}
match ':id', :to => 'posts#show', :as => 'blog_post'
match 'categories/:id', :to => 'categories#show', :as => 'blog_category'
match ':id/comments', :to => 'posts#comment', :as => 'blog_post_blog_comments'
namespace :refinery, :path => '' do
namespace :blog do
root :to => "posts#index"
resources :posts, :only => [:show]
match 'feed.rss', :to => 'posts#index', :as => 'rss_feed', :defaults => {:format => "rss"}
match 'categories/:id', :to => 'categories#show', :as => 'category'
match ':id/comments', :to => 'posts#comment', :as => 'comments'
get 'archive/:year(/:month)', :to => 'posts#archive', :as => 'archive_blog_posts'
get 'tagged/:tag_id(/:tag_name)' => 'posts#tagged', :as => 'tagged_posts'
end
end
namespace :refinery do
namespace :blog do
namespace :admin, :path =>'' do
root :to => "posts#index"
scope(:path => 'refinery', :as => 'refinery_admin', :module => 'admin') do
root :to => 'posts#index'
resources :posts do
collection do
get :uncategorized

View file

@ -10,7 +10,7 @@ module Refinery
Refinery::Plugin.register do |plugin|
plugin.pathname = root
plugin.name = "refinerycms_blog"
plugin.url = app.routes.url_helpers.refinery_blog_admin_posts_path
plugin.url = {:controller => 'refinery/blog/admin/posts'}
plugin.menu_match = /refinery\/blog\/?(posts|comments|categories)?/
plugin.activity = {
:class_name => :'refinery/blog/post'

View file

@ -7,8 +7,8 @@ version = Refinery::Blog::Version.to_s
Gem::Specification.new do |s|
s.name = %q{refinerycms-blog}
s.version = version
s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.}
s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.}
s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with Refinery CMS.}
s.summary = %q{Ruby on Rails blogging engine for Refinery CMS.}
s.email = %q{info@refinerycms.com}
s.homepage = %q{http://refinerycms.com/blog}
s.authors = ['Resolve Digital', 'Neoteric Design']

View file

@ -9,14 +9,14 @@ module Refinery
end
it "sets the correct path for activity entries" do
activity.url.should eq("edit_refinery_admin_blog_post_path")
activity.url.should eq("edit_refinery_blog_admin_post_path")
end
end
describe ".load_seed" do
it "is idempotent" do
Refinery::Blog::Engine.load_seed
Refinery::Blog::Engine.load_seed
Engine.load_seed
Engine.load_seed
Refinery::Page.where(:link_url => '/blog').count.should eq(1)
end

View file

@ -55,8 +55,8 @@ module Refinery
describe "by_archive scope" do
before do
@blog_post1 = FactoryGirl.create(:blog_post, :published_at => Date.new(2011, 3, 11))
@blog_post2 = FactoryGirl.create(:blog_post, :published_at => Date.new(2011, 3, 12))
@post1 = FactoryGirl.create(:blog_post, :published_at => Date.new(2011, 3, 11))
@post2 = FactoryGirl.create(:blog_post, :published_at => Date.new(2011, 3, 12))
#2 months before
FactoryGirl.create(:blog_post, :published_at => Date.new(2011, 1, 10))
@ -66,34 +66,34 @@ module Refinery
#check for this month
date = "03/2011"
subject.class.by_archive(Time.parse(date)).count.should be == 2
subject.class.by_archive(Time.parse(date)).should == [@blog_post2, @blog_post1]
subject.class.by_archive(Time.parse(date)).should == [@post2, @post1]
end
end
describe "all_previous scope" do
before do
@blog_post1 = FactoryGirl.create(:blog_post, :published_at => Time.now - 2.months)
@blog_post2 = FactoryGirl.create(:blog_post, :published_at => Time.now - 1.month)
@post1 = FactoryGirl.create(:blog_post, :published_at => Time.now - 2.months)
@post2 = FactoryGirl.create(:blog_post, :published_at => Time.now - 1.month)
FactoryGirl.create(:blog_post, :published_at => Time.now)
end
it "returns all posts from previous months" do
subject.class.all_previous.count.should be == 2
subject.class.all_previous.should == [@blog_post2, @blog_post1]
subject.class.all_previous.should == [@post2, @post1]
end
end
describe "live scope" do
before do
@blog_post1 = FactoryGirl.create(:blog_post, :published_at => Time.now.advance(:minutes => -2))
@blog_post2 = FactoryGirl.create(:blog_post, :published_at => Time.now.advance(:minutes => -1))
@post1 = FactoryGirl.create(:blog_post, :published_at => Time.now.advance(:minutes => -2))
@post2 = FactoryGirl.create(:blog_post, :published_at => Time.now.advance(:minutes => -1))
FactoryGirl.create(:blog_post, :draft => true)
FactoryGirl.create(:blog_post, :published_at => Time.now + 1.minute)
end
it "returns all posts which aren't in draft and pub date isn't in future" do
subject.class.live.count.should be == 2
subject.class.live.should == [@blog_post2, @blog_post1]
subject.class.live.should == [@post2, @post1]
end
end
@ -128,22 +128,22 @@ module Refinery
describe "#next" do
before do
FactoryGirl.create(:blog_post, :published_at => Time.now.advance(:minutes => -1))
@blog_post = FactoryGirl.create(:blog_post)
@post = FactoryGirl.create(:blog_post)
end
it "returns next article when called on current article" do
subject.class.last.next.should == @blog_post
subject.class.last.next.should == @post
end
end
describe "#prev" do
before do
FactoryGirl.create(:blog_post)
@blog_post = FactoryGirl.create(:blog_post, :published_at => Time.now.advance(:minutes => -1))
@post = FactoryGirl.create(:blog_post, :published_at => Time.now.advance(:minutes => -1))
end
it "returns previous article when called on current article" do
subject.class.first.prev.should == @blog_post
subject.class.first.prev.should == @post
end
end

View file

@ -19,7 +19,6 @@ module Refinery
page.should have_content('there are no new comments')
end
end
context "when has new unapproved comments" do
let!(:blog_comment) { FactoryGirl.create(:blog_comment) }
before(:each) { visit refinery_blog_admin_comments_path }
@ -54,7 +53,6 @@ module Refinery
page.should have_content('there are no approved comments')
end
end
context "when has approved comments" do
let!(:blog_comment) do
FactoryGirl.create(:blog_comment,
@ -86,7 +84,6 @@ module Refinery
page.should have_content('there are no rejected comments')
end
end
context "when has rejected comments" do
let!(:blog_comment) do
FactoryGirl.create(:blog_comment,
@ -110,12 +107,10 @@ module Refinery
describe "#show" do
let!(:blog_comment) { FactoryGirl.create(:blog_comment) }
before(:each) { visit refinery_blog_admin_comment_path(blog_comment) }
it "should display the comment" do
page.should have_content(blog_comment.body)
page.should have_content(blog_comment.name)
end
it "should allow me to approve the comment" do
click_link "Approve this comment"

View file

@ -36,7 +36,7 @@ module Refinery
describe "create blog post" do
before(:each) do
fill_in "Title", :with => "This is my blog post"
fill_in "blog_post_body", :with => "And I love it"
fill_in "post_body", :with => "And I love it"
check blog_category.title
click_button "Save"
end
@ -53,7 +53,7 @@ module Refinery
subject.class.first.author.should eq(::Refinery::User.last)
end
it "should save categories" do
it "should save categories", :focus => true do
subject.class.last.categories.count.should eq(1)
subject.class.last.categories.first.title.should eq(blog_category.title)
end
@ -63,7 +63,7 @@ module Refinery
before(:each) do
@tag_list = "chicago, bikes, beers, babes"
fill_in "Title", :with => "This is a tagged blog post"
fill_in "blog_post_body", :with => "And I also love it"
fill_in "post_body", :with => "And I also love it"
fill_in "Tags", :with => @tag_list
click_button "Save"
end
@ -118,7 +118,7 @@ module Refinery
it "redirects to blog post in the frontend" do
click_link "View this blog post live"
current_path.should == blog_post_path(blog_post)
current_path.should == refinery_blog_post_path(blog_post)
page.should have_content(blog_post.title)
end
end
@ -151,7 +151,7 @@ module Refinery
click_link "Create new post"
fill_in "Title", :with => "This is some other guy's blog post"
fill_in "blog_post_body", :with => "I totally didn't write it."
fill_in "post_body", :with => "I totally didn't write it."
click_link "Advanced Options"

View file

@ -6,15 +6,14 @@ module Refinery
context "has one category and post" do
before(:each) do
@blog_post = FactoryGirl.create(:blog_post, :title => "Refinery CMS blog post")
@blog_category = FactoryGirl.create(:blog_category, :title => "Video Games")
@blog_post.categories << @blog_category
@blog_post.save!
@post = FactoryGirl.create(:blog_post, :title => "Refinery CMS blog post")
@category = FactoryGirl.create(:blog_category, :title => "Video Games")
@post.categories << @category
@post.save!
end
describe "show categories blog posts" do
before(:each) { visit blog_category_path(@blog_category) }
before(:each) { visit refinery_blog_category_path(@category) }
it "should displays categories blog posts" do
page.should have_content("Refinery CMS blog post")
page.should have_content("Video Games")

View file

@ -8,13 +8,13 @@ module Refinery
let!(:blog_post) { FactoryGirl.create(:blog_post, :title => "Refinery CMS blog post") }
it "should display blog post" do
visit blog_post_path(blog_post)
visit refinery_blog_post_path(blog_post)
page.should have_content(blog_post.title)
end
it "should display the blog rss feed" do
get blog_rss_feed_path
get refinery_blog_rss_feed_path
response.should be_success
response.content_type.should eq("application/rss+xml")
@ -25,17 +25,16 @@ module Refinery
context "when has tagged blog posts" do
before(:each) do
@tag_name = "chicago"
@blog_post = FactoryGirl.create(:blog_post,
@post = FactoryGirl.create(:blog_post,
:title => "I Love my city",
:tag_list => @tag_name)
@tag = ::Refinery::Blog::Post.tag_counts_on(:tags).first
end
it "should have one tagged post" do
visit tagged_posts_path(@tag.id, @tag_name.parameterize)
visit refinery_blog_tagged_posts_path(@tag.id, @tag_name.parameterize)
page.should have_content(@tag_name)
page.should have_content(@blog_post.title)
page.should have_content(@post.title)
end
end
end
@ -45,39 +44,35 @@ module Refinery
let(:blog_post) { FactoryGirl.create(:blog_post) }
it "should display the blog post" do
visit blog_post_path(blog_post)
visit refinery_blog_post_path(blog_post)
page.should have_content(blog_post.title)
page.should have_content(blog_post.body)
end
end
context "when has approved comments" do
let(:approved_comment) { FactoryGirl.create(:approved_comment) }
it "should display the comments" do
visit blog_post_path(approved_comment.post)
visit refinery_blog_post_path(approved_comment.post)
page.should have_content(approved_comment.body)
page.should have_content("Posted by #{approved_comment.name}")
end
end
context "when has rejected comments" do
let(:rejected_comment) { FactoryGirl.create(:rejected_comment) }
it "should not display the comments" do
visit blog_post_path(rejected_comment.post)
visit refinery_blog_post_path(rejected_comment.post)
page.should_not have_content(rejected_comment.body)
end
end
context "when has new comments" do
let(:blog_comment) { FactoryGirl.create(:blog_comment) }
it "should not display the comments" do
visit blog_post_path(blog_comment.post)
visit refinery_blog_post_path(blog_comment.post)
page.should_not have_content(blog_comment.body)
end
@ -86,20 +81,18 @@ module Refinery
describe "#show draft preview" do
let(:blog_post) { FactoryGirl.create(:blog_post_draft) }
context "when logged in as admin" do
it "should display the draft notification" do
visit blog_post_path(blog_post)
visit refinery_blog_post_path(blog_post)
page.should have_content('This page is NOT live for public viewing.')
end
end
context "when not logged in as an admin" do
before(:each) { visit destroy_refinery_user_session_path }
it "should not display the blog post" do
visit blog_post_path(blog_post)
visit refinery_blog_post_path(blog_post)
page.should have_content("The page you were looking for doesn't exist (404)")
end