aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/admin/blog/categories_controller.rb12
-rw-r--r--app/controllers/admin/blog/comments_controller.rb64
-rw-r--r--app/controllers/admin/blog/posts_controller.rb144
-rw-r--r--app/controllers/admin/blog/settings_controller.rb68
-rw-r--r--app/controllers/blog/categories_controller.rb20
-rw-r--r--app/controllers/blog/posts_controller.rb152
-rw-r--r--app/helpers/blog_posts_helper.rb9
-rw-r--r--app/mailers/blog/comment_mailer.rb20
-rw-r--r--app/models/blog_post.rb2
-rw-r--r--app/views/admin/blog/categories/_category.html.erb2
-rw-r--r--app/views/admin/blog/categories/_form.html.erb2
-rw-r--r--app/views/admin/blog/categories/index.html.erb6
-rw-r--r--app/views/admin/blog/comments/index.html.erb6
-rw-r--r--app/views/admin/blog/posts/_form.css.erb9
-rw-r--r--app/views/admin/blog/posts/_form.html.erb14
-rw-r--r--app/views/admin/blog/posts/_post.html.erb7
-rw-r--r--app/views/admin/blog/posts/_teaser_part.html.erb4
-rw-r--r--app/views/admin/blog/posts/index.html.erb6
-rw-r--r--app/views/admin/blog/posts/uncategorized.html.erb6
-rw-r--r--app/views/blog/posts/_comment.html.erb4
-rw-r--r--app/views/blog/posts/_nav.html.erb2
-rw-r--r--app/views/blog/posts/_post.html.erb7
-rw-r--r--app/views/blog/posts/show.html.erb2
-rw-r--r--app/views/blog/shared/_post.html.erb11
-rw-r--r--changelog.md9
-rw-r--r--config/locales/bg.yml158
-rw-r--r--config/locales/en.yml1
-rw-r--r--config/routes.rb2
-rw-r--r--features/category.feature2
-rw-r--r--features/support/factories/blog_comments.rb2
-rw-r--r--features/support/factories/blog_posts.rb2
-rw-r--r--features/support/step_definitions/category_steps.rb8
-rw-r--r--features/support/step_definitions/tags_steps.rb4
-rw-r--r--lib/gemspec.rb6
-rw-r--r--lib/refinery/blog/version.rb2
-rw-r--r--lib/refinerycms-blog.rb16
-rw-r--r--refinerycms-blog.gemspec9
-rw-r--r--spec/models/blog_category_spec.rb10
-rw-r--r--spec/models/blog_comment_spec.rb2
-rw-r--r--spec/models/blog_post_spec.rb74
-rw-r--r--todo.md5
41 files changed, 540 insertions, 351 deletions
diff --git a/app/controllers/admin/blog/categories_controller.rb b/app/controllers/admin/blog/categories_controller.rb
index fe15a0b..6933c44 100644
--- a/app/controllers/admin/blog/categories_controller.rb
+++ b/app/controllers/admin/blog/categories_controller.rb
@@ -1,7 +1,11 @@
-class Admin::Blog::CategoriesController < Admin::BaseController
+module Admin
+ module Blog
+ class CategoriesController < Admin::BaseController
- crudify :blog_category,
- :title_attribute => :title,
- :order => 'title ASC'
+ crudify :blog_category,
+ :title_attribute => :title,
+ :order => 'title ASC'
+ end
+ end
end
diff --git a/app/controllers/admin/blog/comments_controller.rb b/app/controllers/admin/blog/comments_controller.rb
index 0dc1db5..1868206 100644
--- a/app/controllers/admin/blog/comments_controller.rb
+++ b/app/controllers/admin/blog/comments_controller.rb
@@ -1,36 +1,40 @@
-class Admin::Blog::CommentsController < Admin::BaseController
+module Admin
+ module Blog
+ class CommentsController < Admin::BaseController
- crudify :blog_comment,
- :title_attribute => :name,
- :order => 'published_at DESC'
+ crudify :blog_comment,
+ :title_attribute => :name,
+ :order => 'published_at DESC'
- def index
- @blog_comments = BlogComment.unmoderated
- render :action => 'index'
- end
+ def index
+ @blog_comments = BlogComment.unmoderated
+ render :action => 'index'
+ end
- def approved
- unless params[:id].present?
- @blog_comments = BlogComment.approved
- render :action => 'index'
- else
- @blog_comment = BlogComment.find(params[:id])
- @blog_comment.approve!
- flash[:notice] = t('admin.blog.comments.approved', :author => @blog_comment.name)
- redirect_to :action => params[:return_to] || 'index'
- end
- end
+ def approved
+ unless params[:id].present?
+ @blog_comments = BlogComment.approved
+ render :action => 'index'
+ else
+ @blog_comment = BlogComment.find(params[:id])
+ @blog_comment.approve!
+ flash[:notice] = t('approved', :scope => 'admin.blog.comments', :author => @blog_comment.name)
+ redirect_to :action => params[:return_to] || 'index'
+ end
+ end
+
+ def rejected
+ unless params[:id].present?
+ @blog_comments = BlogComment.rejected
+ render :action => 'index'
+ else
+ @blog_comment = BlogComment.find(params[:id])
+ @blog_comment.reject!
+ flash[:notice] = t('rejected', :scope => 'admin.blog.comments', :author => @blog_comment.name)
+ redirect_to :action => params[:return_to] || 'index'
+ end
+ end
- def rejected
- unless params[:id].present?
- @blog_comments = BlogComment.rejected
- render :action => 'index'
- else
- @blog_comment = BlogComment.find(params[:id])
- @blog_comment.reject!
- flash[:notice] = t('admin.blog.comments.rejected', :author => @blog_comment.name)
- redirect_to :action => params[:return_to] || 'index'
end
end
-
-end
+end \ No newline at end of file
diff --git a/app/controllers/admin/blog/posts_controller.rb b/app/controllers/admin/blog/posts_controller.rb
index e180741..dbf13b2 100644
--- a/app/controllers/admin/blog/posts_controller.rb
+++ b/app/controllers/admin/blog/posts_controller.rb
@@ -1,86 +1,90 @@
-class Admin::Blog::PostsController < Admin::BaseController
+module Admin
+ module Blog
+ class PostsController < Admin::BaseController
- crudify :blog_post,
- :title_attribute => :title,
- :order => 'published_at DESC'
+ crudify :blog_post,
+ :title_attribute => :title,
+ :order => 'published_at DESC'
- def uncategorized
- @blog_posts = BlogPost.uncategorized.paginate({
- :page => params[:page],
- :per_page => BlogPost.per_page
- })
- end
+ def uncategorized
+ @blog_posts = BlogPost.uncategorized.paginate({
+ :page => params[:page],
+ :per_page => BlogPost.per_page
+ })
+ end
- def tags
- op = case ActiveRecord::Base.connection.adapter_name.downcase
- when 'postgresql'
- '~*'
- else
- 'LIKE'
- end
- wildcard = case ActiveRecord::Base.connection.adapter_name.downcase
- when 'postgresql'
- '.*'
- else
- '%'
- end
- @tags = BlogPost.tag_counts_on(:tags).where(
- ["tags.name #{op} ?", "#{wildcard}#{params[:term].to_s.downcase}#{wildcard}"]
- ).map { |tag| {:id => tag.id, :value => tag.name}}
- render :json => @tags.flatten
- end
+ def tags
+ op = case ActiveRecord::Base.connection.adapter_name.downcase
+ when 'postgresql'
+ '~*'
+ else
+ 'LIKE'
+ end
+ wildcard = case ActiveRecord::Base.connection.adapter_name.downcase
+ when 'postgresql'
+ '.*'
+ else
+ '%'
+ end
+ @tags = BlogPost.tag_counts_on(:tags).where(
+ ["tags.name #{op} ?", "#{wildcard}#{params[:term].to_s.downcase}#{wildcard}"]
+ ).map { |tag| {:id => tag.id, :value => tag.name}}
+ render :json => @tags.flatten
+ end
- def create
- # if the position field exists, set this object as last object, given the conditions of this class.
- if BlogPost.column_names.include?("position")
- params[:blog_post].merge!({
- :position => ((BlogPost.maximum(:position, :conditions => "")||-1) + 1)
- })
- end
+ def create
+ # if the position field exists, set this object as last object, given the conditions of this class.
+ if BlogPost.column_names.include?("position")
+ params[:blog_post].merge!({
+ :position => ((BlogPost.maximum(:position, :conditions => "")||-1) + 1)
+ })
+ end
- if BlogPost.column_names.include?("user_id")
- params[:blog_post].merge!({
- :user_id => current_user.id
- })
- end
+ if BlogPost.column_names.include?("user_id")
+ params[:blog_post].merge!({
+ :user_id => current_user.id
+ })
+ end
- if (@blog_post = BlogPost.create(params[:blog_post])).valid?
- (request.xhr? ? flash.now : flash).notice = t(
- 'refinery.crudify.created',
- :what => "'#{@blog_post.title}'"
- )
+ if (@blog_post = BlogPost.create(params[:blog_post])).valid?
+ (request.xhr? ? flash.now : flash).notice = t(
+ 'refinery.crudify.created',
+ :what => "'#{@blog_post.title}'"
+ )
- unless from_dialog?
- unless params[:continue_editing] =~ /true|on|1/
- redirect_back_or_default(admin_blog_posts_url)
+ unless from_dialog?
+ unless params[:continue_editing] =~ /true|on|1/
+ redirect_back_or_default(admin_blog_posts_url)
+ else
+ unless request.xhr?
+ redirect_to :back
+ else
+ render :partial => "/shared/message"
+ end
+ end
+ else
+ render :text => "<script>parent.window.location = '#{admin_blog_posts_url}';</script>"
+ end
else
unless request.xhr?
- redirect_to :back
+ render :action => 'new'
else
- render :partial => "/shared/message"
+ render :partial => "/shared/admin/error_messages",
+ :locals => {
+ :object => @blog_post,
+ :include_object_name => true
+ }
end
end
- else
- render :text => "<script>parent.window.location = '#{admin_blog_posts_url}';</script>"
- end
- else
- unless request.xhr?
- render :action => 'new'
- else
- render :partial => "/shared/admin/error_messages",
- :locals => {
- :object => @blog_post,
- :include_object_name => true
- }
end
- end
- end
- before_filter :find_all_categories,
- :only => [:new, :edit, :create, :update]
+ before_filter :find_all_categories,
+ :only => [:new, :edit, :create, :update]
-protected
- def find_all_categories
- @blog_categories = BlogCategory.find(:all)
+ protected
+ def find_all_categories
+ @blog_categories = BlogCategory.find(:all)
+ end
+ end
end
-end
+end \ No newline at end of file
diff --git a/app/controllers/admin/blog/settings_controller.rb b/app/controllers/admin/blog/settings_controller.rb
index a805d9c..7d0c230 100644
--- a/app/controllers/admin/blog/settings_controller.rb
+++ b/app/controllers/admin/blog/settings_controller.rb
@@ -1,39 +1,43 @@
-class Admin::Blog::SettingsController < Admin::BaseController
+module Admin
+ module Blog
+ class SettingsController < Admin::BaseController
- def notification_recipients
- @recipients = BlogComment::Notification.recipients
+ def notification_recipients
+ @recipients = BlogComment::Notification.recipients
- if request.post?
- BlogComment::Notification.recipients = params[:recipients]
- flash[:notice] = t('admin.blog.settings.notification_recipients.updated',
- :recipients => BlogComment::Notification.recipients)
- unless request.xhr? or from_dialog?
- redirect_back_or_default(admin_blog_posts_path)
- else
- render :text => "<script type='text/javascript'>parent.window.location = '#{admin_blog_posts_path}';</script>",
- :layout => false
+ if request.post?
+ BlogComment::Notification.recipients = params[:recipients]
+ flash[:notice] = t('updated', :scope => 'admin.blog.settings.notification_recipients',
+ :recipients => BlogComment::Notification.recipients)
+ unless request.xhr? or from_dialog?
+ redirect_back_or_default(admin_blog_posts_path)
+ else
+ render :text => "<script type='text/javascript'>parent.window.location = '#{admin_blog_posts_path}';</script>",
+ :layout => false
+ end
+ end
end
- end
- end
- def moderation
- enabled = BlogComment::Moderation.toggle!
- unless request.xhr?
- redirect_back_or_default(admin_blog_posts_path)
- else
- render :json => {:enabled => enabled},
- :layout => false
- end
- end
+ def moderation
+ enabled = BlogComment::Moderation.toggle!
+ unless request.xhr?
+ redirect_back_or_default(admin_blog_posts_path)
+ else
+ render :json => {:enabled => enabled},
+ :layout => false
+ end
+ end
+
+ def comments
+ enabled = BlogComment.toggle!
+ unless request.xhr?
+ redirect_back_or_default(admin_blog_posts_path)
+ else
+ render :json => {:enabled => enabled},
+ :layout => false
+ end
+ end
- def comments
- enabled = BlogComment.toggle!
- unless request.xhr?
- redirect_back_or_default(admin_blog_posts_path)
- else
- render :json => {:enabled => enabled},
- :layout => false
end
end
-
-end
+end \ No newline at end of file
diff --git a/app/controllers/blog/categories_controller.rb b/app/controllers/blog/categories_controller.rb
index 35a87c3..efda778 100644
--- a/app/controllers/blog/categories_controller.rb
+++ b/app/controllers/blog/categories_controller.rb
@@ -1,11 +1,13 @@
-class Blog::CategoriesController < BlogController
+module Blog
+ class CategoriesController < BlogController
- def show
- @category = BlogCategory.find(params[:id])
- @blog_posts = @category.posts.live.includes(:comments, :categories).paginate({
- :page => params[:page],
- :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10)
- })
- end
+ def show
+ @category = BlogCategory.find(params[:id])
+ @blog_posts = @category.posts.live.includes(:comments, :categories).paginate({
+ :page => params[:page],
+ :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10)
+ })
+ end
-end
+ end
+end \ No newline at end of file
diff --git a/app/controllers/blog/posts_controller.rb b/app/controllers/blog/posts_controller.rb
index 4ea2e73..9dc595c 100644
--- a/app/controllers/blog/posts_controller.rb
+++ b/app/controllers/blog/posts_controller.rb
@@ -1,101 +1,103 @@
-class Blog::PostsController < BlogController
+module Blog
+ class PostsController < BlogController
- before_filter :find_all_blog_posts, :except => [:archive]
- before_filter :find_blog_post, :only => [:show, :comment, :update_nav]
- before_filter :find_tags
+ before_filter :find_all_blog_posts, :except => [:archive]
+ before_filter :find_blog_post, :only => [:show, :comment, :update_nav]
+ before_filter :find_tags
- respond_to :html, :js, :rss
+ respond_to :html, :js, :rss
- def index
- respond_with (@blog_posts) do |format|
- format.html
- format.rss
+ def index
+ respond_with (@blog_posts) do |format|
+ format.html
+ format.rss
+ end
end
- end
- def show
- @blog_comment = BlogComment.new
+ def show
+ @blog_comment = BlogComment.new
- respond_with (@blog_post) do |format|
- format.html { present(@blog_post) }
- format.js { render :partial => 'post', :layout => false }
+ respond_with (@blog_post) do |format|
+ format.html { present(@blog_post) }
+ format.js { render :partial => 'post', :layout => false }
+ end
end
- end
- def comment
- if (@blog_comment = @blog_post.comments.create(params[:blog_comment])).valid?
- if BlogComment::Moderation.enabled? or @blog_comment.ham?
- begin
- Blog::CommentMailer.notification(@blog_comment, request).deliver
- rescue
- logger.warn "There was an error delivering a blog comment notification.\n#{$!}\n"
+ def comment
+ if (@blog_comment = @blog_post.comments.create(params[:blog_comment])).valid?
+ if BlogComment::Moderation.enabled? or @blog_comment.ham?
+ begin
+ Blog::CommentMailer.notification(@blog_comment, request).deliver
+ rescue
+ logger.warn "There was an error delivering a blog comment notification.\n#{$!}\n"
+ end
end
+
+ if BlogComment::Moderation.enabled?
+ flash[:notice] = t('thank_you_moderated', :scope => 'blog.posts.comments')
+ redirect_to blog_post_url(params[:id])
+ else
+ flash[:notice] = t('thank_you', :scope => 'blog.posts.comments')
+ redirect_to blog_post_url(params[:id],
+ :anchor => "comment-#{@blog_comment.to_param}")
+ end
+ else
+ render :action => 'show'
end
+ end
- if BlogComment::Moderation.enabled?
- flash[:notice] = t('blog.posts.comments.thank_you_moderated')
- redirect_to blog_post_url(params[:id])
+ def archive
+ if params[:month].present?
+ date = "#{params[:month]}/#{params[:year]}"
+ @archive_date = Time.parse(date)
+ @date_title = @archive_date.strftime('%B %Y')
+ @blog_posts = BlogPost.live.by_archive(@archive_date).paginate({
+ :page => params[:page],
+ :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10)
+ })
else
- flash[:notice] = t('blog.posts.comments.thank_you')
- redirect_to blog_post_url(params[:id],
- :anchor => "comment-#{@blog_comment.to_param}")
+ date = "01/#{params[:year]}"
+ @archive_date = Time.parse(date)
+ @date_title = @archive_date.strftime('%Y')
+ @blog_posts = BlogPost.live.by_year(@archive_date).paginate({
+ :page => params[:page],
+ :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10)
+ })
end
- else
- render :action => 'show'
+ respond_with (@blog_posts)
end
- end
- def archive
- if params[:month].present?
- date = "#{params[:month]}/#{params[:year]}"
- @archive_date = Time.parse(date)
- @date_title = @archive_date.strftime('%B %Y')
- @blog_posts = BlogPost.live.by_archive(@archive_date).paginate({
- :page => params[:page],
- :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10)
- })
- else
- date = "01/#{params[:year]}"
- @archive_date = Time.parse(date)
- @date_title = @archive_date.strftime('%Y')
- @blog_posts = BlogPost.live.by_year(@archive_date).paginate({
+ def tagged
+ @tag = ActsAsTaggableOn::Tag.find(params[:tag_id])
+ @tag_name = @tag.name
+ @blog_posts = BlogPost.tagged_with(@tag_name).paginate({
:page => params[:page],
:per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10)
})
end
- respond_with (@blog_posts)
- end
- def tagged
- @tag = ActsAsTaggableOn::Tag.find(params[:tag_id])
- @tag_name = @tag.name
- @blog_posts = BlogPost.tagged_with(@tag_name).paginate({
- :page => params[:page],
- :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10)
- })
- end
-
-protected
+ protected
- def find_blog_post
- unless (@blog_post = BlogPost.find(params[:id])).try(:live?)
- if refinery_user? and current_user.authorized_plugins.include?("refinerycms_blog")
- @blog_post = BlogPost.find(params[:id])
- else
- error_404
+ def find_blog_post
+ unless (@blog_post = BlogPost.find(params[:id])).try(:live?)
+ if refinery_user? and current_user.authorized_plugins.include?("refinerycms_blog")
+ @blog_post = BlogPost.find(params[:id])
+ else
+ error_404
+ end
end
end
- end
- def find_all_blog_posts
- @blog_posts = BlogPost.live.includes(:comments, :categories).paginate({
- :page => params[:page],
- :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10)
- })
- end
+ def find_all_blog_posts
+ @blog_posts = BlogPost.live.includes(:comments, :categories).paginate({
+ :page => params[:page],
+ :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10)
+ })
+ end
- def find_tags
- @tags = BlogPost.tag_counts_on(:tags)
- end
+ def find_tags
+ @tags = BlogPost.tag_counts_on(:tags)
+ end
-end
+ end
+end \ No newline at end of file
diff --git a/app/helpers/blog_posts_helper.rb b/app/helpers/blog_posts_helper.rb
index 5f68c04..a15de1d 100644
--- a/app/helpers/blog_posts_helper.rb
+++ b/app/helpers/blog_posts_helper.rb
@@ -3,7 +3,7 @@ module BlogPostsHelper
posts = BlogPost.select('published_at').all_previous
return nil if posts.blank?
html = '<section id="blog_archive_list"><h2>'
- html << t('blog.shared.archives')
+ html << t('archives', :scope => 'blog.shared')
html << '</h2><nav><ul>'
links = []
super_old_links = []
@@ -43,14 +43,13 @@ module BlogPostsHelper
end
def blog_post_teaser(post)
- if post.custom_teaser.present?
+ if post.respond_to?(:custom_teaser) && post.custom_teaser.present?
post.custom_teaser.html_safe
else
- truncate(
- post.body,
+ truncate(post.body, {
:length => RefinerySetting.find_or_set(:blog_post_teaser_length, 250),
:preserve_html_tags => true
- ).html_safe
+ }).html_safe
end
end
end
diff --git a/app/mailers/blog/comment_mailer.rb b/app/mailers/blog/comment_mailer.rb
index 3e4c76d..3710ea1 100644
--- a/app/mailers/blog/comment_mailer.rb
+++ b/app/mailers/blog/comment_mailer.rb
@@ -1,11 +1,13 @@
-class Blog::CommentMailer < ActionMailer::Base
+module Blog
+ class CommentMailer < ActionMailer::Base
- def notification(comment, request)
- subject BlogComment::Notification.subject
- recipients BlogComment::Notification.recipients
- from "\"#{RefinerySetting[:site_name]}\" <no-reply@#{request.domain(RefinerySetting.find_or_set(:tld_length, 1))}>"
- sent_on Time.now
- @comment = comment
- end
+ def notification(comment, request)
+ subject BlogComment::Notification.subject
+ recipients BlogComment::Notification.recipients
+ from "\"#{RefinerySetting[:site_name]}\" <no-reply@#{request.domain(RefinerySetting.find_or_set(:tld_length, 1))}>"
+ sent_on Time.now
+ @comment = comment
+ end
-end
+ end
+end \ No newline at end of file
diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb
index 2126827..ef88f1e 100644
--- a/app/models/blog_post.rb
+++ b/app/models/blog_post.rb
@@ -26,8 +26,6 @@ class BlogPost < ActiveRecord::Base
:approximate_ascii => RefinerySetting.find_or_set(:approximate_ascii, false, :scoping => 'blog'),
:strip_non_ascii => RefinerySetting.find_or_set(:strip_non_ascii, false, :scoping => 'blog')
- attr_accessible :title, :body, :tag_list, :draft, :published_at, :browser_title, :meta_keywords, :meta_description, :user_id, :category_ids, :custom_url, :custom_teaser
-
scope :by_archive, lambda { |archive_date|
where(['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month])
}
diff --git a/app/views/admin/blog/categories/_category.html.erb b/app/views/admin/blog/categories/_category.html.erb
index d8c8a61..191f649 100644
--- a/app/views/admin/blog/categories/_category.html.erb
+++ b/app/views/admin/blog/categories/_category.html.erb
@@ -11,6 +11,6 @@
:class => "cancel confirm-delete",
:title => t('.delete'),
:method => :delete,
- :confirm => t('shared.admin.delete.message', :title => category.title) %>
+ :confirm => t('message', :scope => 'shared.admin.delete', :title => category.title) %>
</span>
</li>
diff --git a/app/views/admin/blog/categories/_form.html.erb b/app/views/admin/blog/categories/_form.html.erb
index f55992a..bfcbc7b 100644
--- a/app/views/admin/blog/categories/_form.html.erb
+++ b/app/views/admin/blog/categories/_form.html.erb
@@ -14,6 +14,6 @@
:locals => {
:f => f,
:continue_editing => false,
- :delete_title => t('admin.blog.categories.category.delete')
+ :delete_title => t('delete', :scope => 'admin.blog.categories.category')
} %>
<% end %>
diff --git a/app/views/admin/blog/categories/index.html.erb b/app/views/admin/blog/categories/index.html.erb
index 60ade7a..5d17d42 100644
--- a/app/views/admin/blog/categories/index.html.erb
+++ b/app/views/admin/blog/categories/index.html.erb
@@ -1,12 +1,12 @@
<%= render :partial => '/admin/blog/submenu' %>
<div id='records'>
<% if searching? %>
- <h2><%= t('shared.admin.search.results_for', :query => params[:search]) %></h2>
+ <h2><%= t('results_for', :scope => 'shared.admin.search', :query => params[:search]) %></h2>
<% if @blog_categories.any? %>
<%= render :partial => "blog_categories",
:collection => @blog_categories %>
<% else %>
- <p><%= t('admin.search_no_results') %></p>
+ <p><%= t('search_no_results', :scope => 'admin') %></p>
<% end %>
<% else %>
<% if @blog_categories.any? %>
@@ -18,7 +18,7 @@
<% else %>
<p>
<strong>
- <%= t('.no_items_yet', :create => t('admin.blog.submenu.categories.new')) %>
+ <%= t('.no_items_yet', :create => t('new', :scope => 'admin.blog.submenu.categories')) %>
</strong>
</p>
<% end %>
diff --git a/app/views/admin/blog/comments/index.html.erb b/app/views/admin/blog/comments/index.html.erb
index fbf268d..aaec4ae 100644
--- a/app/views/admin/blog/comments/index.html.erb
+++ b/app/views/admin/blog/comments/index.html.erb
@@ -1,7 +1,7 @@
<%= render :partial => '/admin/blog/submenu' %>
<div id='records'>
<% if searching? %>
- <h2><%= t('shared.admin.search.results_for', :query => params[:search]) %></h2>
+ <h2><%= t('results_for', :scope => 'shared.admin.search', :query => params[:search]) %></h2>
<% if @blog_comments.any? %>
<%=# will_paginate @blog_comments
%>
@@ -14,7 +14,7 @@
<%=# will_paginate @blog_comments
%>
<% else %>
- <p><%= t('admin.search_no_results') %></p>
+ <p><%= t('search_no_results', :scope => 'admin') %></p>
<% end %>
<% else %>
<% if @blog_comments.any? %>
@@ -28,7 +28,7 @@
<% else %>
<h3>
<%= t('.no_items_yet',
- :type => t("admin.blog.submenu.comments.#{action_name.gsub('index', 'new')}").downcase) %>
+ :type => t(action_name.gsub('index', 'new'), :scope => 'admin.blog.submenu.comments').downcase) %>
</h3>
<% end %>
<% end %>
diff --git a/app/views/admin/blog/posts/_form.css.erb b/app/views/admin/blog/posts/_form.css.erb
index 48bbbfa..869ab9b 100644
--- a/app/views/admin/blog/posts/_form.css.erb
+++ b/app/views/admin/blog/posts/_form.css.erb
@@ -1,8 +1,13 @@
<style type='text/css'>
+ ul.blog_categories{
+ height:200px;
+ overflow:auto;
+ border:1px solid #ccc;
+ padding:5px;
+ }
ul.blog_categories, ul.blog_categories li {
list-style: none;
- margin: 0px;
- padding: 0px;
+ margin:5px 0;
}
a#copy_body_link {
background: url("/images/refinery/icons/add.png") no-repeat scroll 0 6px transparent;
diff --git a/app/views/admin/blog/posts/_form.html.erb b/app/views/admin/blog/posts/_form.html.erb
index 20a8fe1..ffb790d 100644
--- a/app/views/admin/blog/posts/_form.html.erb
+++ b/app/views/admin/blog/posts/_form.html.erb
@@ -14,10 +14,10 @@
<div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content ui-corner-all'>
<ul id='page_parts'>
<li class='ui-state-default ui-state-active'>
- <%= link_to "Body", "#page_part_body" %>
+ <%= link_to t('body', :scope => 'activerecord.attributes.blog_post'), "#page_part_body" %>
</li>
<li class='ui-state-default'>
- <%= link_to "Teaser", "#page_part_teaser" %>
+ <%= link_to t('teaser', :scope => 'activerecord.attributes.blog_post'), "#page_part_teaser" %>
</li>
<% Refinery::Blog.tabs.each_with_index do |tab, tab_index| %>
<li class='ui-state-default' id="custom_<%= tab.name %>_tab">
@@ -38,7 +38,7 @@
:locals => {
: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} %>
@@ -49,7 +49,7 @@
</div>
<div class='field'>
- <%= f.label :tag_list, "Tags" -%>
+ <%= f.label :tag_list, t('blog.shared.tags.title') -%>
<%= f.text_field :tag_list, :class => 'larger' -%>
</div>
@@ -66,10 +66,12 @@
</div>
<div id='more_options' style="display:none;">
<div class="hemisquare">
- <h3><%= t('admin.blog.submenu.categories.title') %></h3>
+ <h3><%= t('title', :scope => 'admin.blog.submenu.categories') %></h3>
<ul class='blog_categories'>
<% @blog_categories.each do |category| %>
<li>
+ <%= hidden_field_tag 'blog_post[category_ids][]', category.id,
+ :value => 0 %>
<%= check_box_tag 'blog_post[category_ids][]', category.id,
@blog_post.categories.include?(category),
:id => (id="blog_post_category_ids_#{category.id}") %>
@@ -99,7 +101,7 @@
:locals => {
:f => f,
:continue_editing => true,
- :delete_title => t('admin.blog.posts.post.delete')
+ :delete_title => t('delete', :scope => 'admin.blog.posts.post')
} %>
<% end -%>
diff --git a/app/views/admin/blog/posts/_post.html.erb b/app/views/admin/blog/posts/_post.html.erb
index 1226082..a7f09e0 100644
--- a/app/views/admin/blog/posts/_post.html.erb
+++ b/app/views/admin/blog/posts/_post.html.erb
@@ -1,7 +1,10 @@
<li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(post) -%>">
<span class='title'>
<%= post.title %>
- <span class="preview"><%= post.published_at.try(:strftime, '%b %d, %Y') || 'draft' %><%= " by #{post.author.username}" if post.author.present? %></span>
+ <span class="preview">
+ <%= post.published_at.try(:strftime, '%b %d, %Y') || 'draft' %>
+ <%= " by #{post.author.username}" if post.author.present? %>
+ </span>
</span>
<span class='actions'>
<%= link_to refinery_icon_tag("application_go.png"), blog_post_url(post),
@@ -13,6 +16,6 @@
:class => "cancel confirm-delete",
:title => t('.delete'),
:method => :delete,
- :confirm => t('shared.admin.delete.message', :title => post.title) %>
+ :confirm => t('message', :scope => 'shared.admin.delete', :title => post.title) %>
</span>
</li>
diff --git a/app/views/admin/blog/posts/_teaser_part.html.erb b/app/views/admin/blog/posts/_teaser_part.html.erb
index d615812..71d7d01 100644
--- a/app/views/admin/blog/posts/_teaser_part.html.erb
+++ b/app/views/admin/blog/posts/_teaser_part.html.erb
@@ -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('admin.blog.posts.form.copy_body'), "#",
+ <%= link_to t('copy_body', :scope => 'admin.blog.posts.form'), "#",
:id => 'copy_body_link',
- :title => t('admin.blog.posts.form.copy_body_help') %>
+ :title => t('copy_body_help', :scope => 'admin.blog.posts.form') %>
</span>
</p>
</div>
diff --git a/app/views/admin/blog/posts/index.html.erb b/app/views/admin/blog/posts/index.html.erb
index f9baaac..90a6a6e 100644
--- a/app/views/admin/blog/posts/index.html.erb
+++ b/app/views/admin/blog/posts/index.html.erb
@@ -1,14 +1,14 @@
<%= render :partial => '/admin/blog/submenu' %>
<div id='records'>
<% if searching? %>
- <h2><%= t('shared.admin.search.results_for', :query => params[:search]) %></h2>
+ <h2><%= t('results_for', :scope => 'shared.admin.search', :query => params[:search]) %></h2>
<% if @blog_posts.any? %>
<ul>
<%= render :partial => "post",
:collection => @blog_posts %>
</ul>
<% else %>
- <p><%= t('shared.admin.search.no_results') %></p>
+ <p><%= t('no_results', :scope => 'shared.admin.search') %></p>
<% end %>
<% else %>
<% if @blog_posts.any? %>
@@ -20,7 +20,7 @@
<% else %>
<p>
<strong>
- <%= t('.no_items_yet', :create => t('admin.blog.submenu.posts.new')) %>
+ <%= t('.no_items_yet', :create => t('new', :scope => 'admin.blog.submenu.posts')) %>
</strong>
</p>
<% end %>
diff --git a/app/views/admin/blog/posts/uncategorized.html.erb b/app/views/admin/blog/posts/uncategorized.html.erb
index 888daab..19d9e20 100644
--- a/app/views/admin/blog/posts/uncategorized.html.erb
+++ b/app/views/admin/blog/posts/uncategorized.html.erb
@@ -1,12 +1,12 @@
<%= render :partial => '/admin/blog/submenu' %>
<div id='records'>
<% if searching? %>
- <h2><%= t('shared.admin.search.results_for', :query => params[:search]) %></h2>
+ <h2><%= t('results_for', :scope => 'shared.admin.search', :query => params[:search]) %></h2>
<% if @blog_posts.any? %>
<%= render :partial => "blog_posts",
:collection => @blog_posts %>
<% else %>
- <p><%= t('admin.search_no_results') %></p>
+ <p><%= t('search_no_results', :scope => 'admin') %></p>
<% end %>
<% else %>
<% if @blog_posts.any? %>
@@ -18,7 +18,7 @@
<% else %>
<p>
<strong>
- <%= t('.no_items_yet', :create => t('admin.blog.submenu.posts.new')) %>
+ <%= t('.no_items_yet', :create => t('new', :scope => 'admin.blog.submenu.posts')) %>
</strong>
</p>
<% end %>
diff --git a/app/views/blog/posts/_comment.html.erb b/app/views/blog/posts/_comment.html.erb
index 17b2002..5503826 100644
--- a/app/views/blog/posts/_comment.html.erb
+++ b/app/views/blog/posts/_comment.html.erb
@@ -3,8 +3,8 @@
<%= simple_format auto_link(comment.message.to_s) %>
<footer class='blog_comment_author'>
<p>
- <%= t('blog.posts.comments.by', :who => comment.name) %>,
- <%= t('blog.posts.comments.time_ago', :time => time_ago_in_words(comment.created_at)) %>
+ <%= t('by', :scope => 'blog.posts.comments', :who => comment.name) %>,
+ <%= t('time_ago', :scope => 'blog.posts.comments', :time => time_ago_in_words(comment.created_at)) %>
</p>
</footer>
</article>
diff --git a/app/views/blog/posts/_nav.html.erb b/app/views/blog/posts/_nav.html.erb
index c73a294..df4b435 100644
--- a/app/views/blog/posts/_nav.html.erb
+++ b/app/views/blog/posts/_nav.html.erb
@@ -3,7 +3,7 @@
<%= link_to (truncate(@blog_post.next.title) + " &#187;").html_safe, @blog_post.next, :class => 'next' %>
<% end -%>
- <%= link_to t('blog.posts.show.blog_home'), blog_root_path, :class => 'home' %>
+ <%= link_to t('blog_home', :scope => 'blog.posts.show'), blog_root_path, :class => 'home' %>
<% if @blog_post.prev.present? -%>
<%= link_to ("&#171; " + truncate(@blog_post.prev.title)).html_safe, @blog_post.prev, :class => 'prev' %>
diff --git a/app/views/blog/posts/_post.html.erb b/app/views/blog/posts/_post.html.erb
index 6d715c3..12978d3 100644
--- a/app/views/blog/posts/_post.html.erb
+++ b/app/views/blog/posts/_post.html.erb
@@ -8,11 +8,12 @@
<h1><%= @blog_post.title %></h1>
<section class='details'>
<time datetime="<%=l @blog_post.published_at.to_date, :format => :default %>" class='posted_at'>
- <%= t('blog.shared.posts.created_at', :when => l(@blog_post.published_at.to_date, :format => :short)) %>
- </time><%= "#{t('blog.posts.show.by')} #{@blog_post.author.username}" if @blog_post.author.present? %>.
+ <%= t('created_at', :scope => 'blog.shared.posts', :when => l(@blog_post.published_at.to_date, :format => :short)) %>
+ </time>
+ <%= "#{t('by', :scope => 'blog.posts.show')} #{@blog_post.author.username}" if @blog_post.author.present? %>.
<% if (categories = @blog_post.categories).any? %>
<aside class='filed_in'>
- <%= t('blog.posts.show.filed_in') %>
+ <%= t('filed_in', :scope => 'blog.posts.show') %>
<% categories.each_with_index do |category, index| %>
<%= link_to category.title, blog_category_url(category) -%><%= ',' if index < ((categories.length) - 1) %>
<% end %>
diff --git a/app/views/blog/posts/show.html.erb b/app/views/blog/posts/show.html.erb
index 97b8af2..cc763a8 100644
--- a/app/views/blog/posts/show.html.erb
+++ b/app/views/blog/posts/show.html.erb
@@ -10,7 +10,7 @@
<%= render :partial => "comment", :collection => comments %>
<% else %>
<p>
- <%= t('blog.shared.comments.none') %>.
+ <%= t('none', :scope => 'blog.shared.comments') %>.
</p>
<% end %>
diff --git a/app/views/blog/shared/_post.html.erb b/app/views/blog/shared/_post.html.erb
index 2281691..0f65e1d 100644
--- a/app/views/blog/shared/_post.html.erb
+++ b/app/views/blog/shared/_post.html.erb
@@ -4,8 +4,9 @@
<h1><%= link_to post.title, blog_post_url(post) %></h1>
<section class='details'>
<time datetime="<%=l post.published_at.to_date, :format => :default %>" class='posted_at'>
- <%= t('blog.shared.posts.created_at', :when => l(post.published_at.to_date, :format => :short)) %>
- </time><%= "#{t('blog.posts.show.by')} #{post.author.username}" if post.author.present? %>.
+ <%= t('created_at', :scope => '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? %>.
<% if (categories = post.categories).any? %>
<aside class='filed_in'>
<%= t('filed_in', :scope => 'blog.posts.show') %>
@@ -25,14 +26,14 @@
</section>
<footer>
<p>
- <%= link_to t('blog.shared.posts.read_more'), blog_post_url(post) %>
+ <%= link_to t('read_more', :scope => 'blog.shared.posts'), blog_post_url(post) %>
</p>
<aside class='comment_count'>
<% if BlogPost.comments_allowed? %>
<% if post.comments.any? %>
- (<%= pluralize(post.comments.approved.count, t('blog.shared.comments.singular')) %>)
+ (<%= pluralize(post.comments.approved.count, t('singular', :scope => 'blog.shared.comments')) %>)
<% else %>
- (<%= t('blog.shared.comments.none') %>)
+ (<%= t('none', :scope => 'blog.shared.comments') %>)
<% end %>
<% end %>
</aside>
diff --git a/changelog.md b/changelog.md
index c54b79b..e6415e6 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,12 @@
-## 1.7 [UNRELEASED]
+## 1.6.3 [UNRELEASED]
+* Bulgarian translations [mirosr](https://github.com/mirosr)
+* posts/tagged... params[:tag_name] is optional [joemsak](https://github.com/joemsak)
+
+## 1.6.2 [29 June 2011]
* Custom teaser field to overwrite the automatic truncation of the body [wikyd](https://github.com/wikyd)
+* Tagging URL strategy updated again [joemsak](https://github.com/joemsak)
+* Tagging bug fixed [ruprict](https://github.com/ruprict)
+* Refactored specs [parndt](https://github.com/parndt)
## 1.6.1 [21 June 2011]
* Tagging URL strategy updated for reliability /blog/posts/tagged/ID-name-parameterized [joemsak](https://github.com/joemsak)
diff --git a/config/locales/bg.yml b/config/locales/bg.yml
new file mode 100644
index 0000000..1517586
--- /dev/null
+++ b/config/locales/bg.yml
@@ -0,0 +1,158 @@
+bg:
+ plugins:
+ refinerycms_blog:
+ title: Блог
+ admin:
+ blog:
+ categories:
+ category:
+ edit: Редактиране на тази категория
+ delete: Изтриване на тази категория завинаги
+ index:
+ no_items_yet: 'Все още няма категории. Натиснете "%{create}", за да въведете категория.'
+ comments:
+ approved: 'Коментара от "%{author}" бе одобрен.'
+ comment:
+ view_live_html: 'Преглед на този коментар <br/><em>(ще се отвори се в нов прозорец)</em>'
+ read: Прочитане на този коментар
+ reject: Отхвърляне на този коментар
+ approve: Одобряване на този коментар
+ rejected: 'Коментара от "%{author}" бе отхвърлен.'
+ index:
+ no_items_yet: '%{type} коментари не бяха намерени.'
+ show:
+ comment: Коментар
+ blog_post: Публикация
+ from: Публикувано от
+ date: Публикувано на
+ message: Коментар
+ details: Детайли
+ age: Възраст
+ actions: Действия
+ back: Обратно към всички коментари
+ reject: Отхвърляне на този коментар
+ approve: Одобряване на този коментар
+ posts:
+ form:
+ advanced_options: Разширени настройки
+ toggle_advanced_options: Натиснете, за да достъпите настройките за етикета "meta" и менюто
+ save_as_draft: Запис като чернова
+ published_at: Дата на публикуване
+ custom_url: Url по избор
+ custom_url_help: Вместо от заглавието, генерирайте url за тази публикация чрез този текст.
+ copy_body: Копиране на съдържанието на публикацията като извадка
+ copy_body_help: Копира съдържанието на публикацията като извадка. Оставете извадката празна и Refinery автоматично ще я сглоби.
+ index:
+ no_items_yet: 'Все още няма публикации. Натиснете "%{create}", за да въведете публикация.'
+ uncategorized:
+ no_items_yet: 'Не съществуват некатегоризирани публикации.'
+ post:
+ view_live_html: 'Преглед на този публикация <br/><em>(ще се отвори се в нов прозорец)</em>'
+ edit: Редактиране на тази публикация
+ delete: Премахване на тази публикация завинаги
+ settings:
+ notification_recipients:
+ value: Изпращане на уведомления до
+ explanation: 'Всеки път, когато някой коментира публикация, Refinery ще изпраща е-писмо, за да уведоми, че съществува нов коментар.'
+ hint: 'При добавяне на коментар, Refinery ще Ви уведоми по е-пощата.'
+ example: "Въведете адреса(ите) на Вашата е-поща. Например: jack@work.com, jill@office.com"
+ updated: 'Уведомления бяха изпратени до "%{recipients}"'
+ submenu:
+ categories:
+ title: Категории
+ manage: Управление
+ new: Добавяне на нова категория
+ comments:
+ title: Коментари
+ title_with_count: 'Коментари (%{new_count} нови)'
+ new: Нови
+ unmoderated: Нови
+ approved: Одобрени
+ rejected: Отхвърлени
+ posts:
+ title: Публикации
+ manage: Управление на публикации
+ new: Добавяне на нова публикация
+ uncategorized: Некатегоризирани публикации
+ settings:
+ title: Настройки
+ moderation: Модерация
+ update_notified: Получатели на уведомления
+ comments: Коментари
+ blog:
+ comment_mailer:
+ notification:
+ greeting: Здравейте
+ you_recieved_new_comment: Току що получихте нов коментар на Вашия уебсайт.
+ comment_starts: --- Начало на коментара ---
+ comment_ends: --- Край на коментара ---
+ from: От
+ email: Е-поща
+ message: Съобщение
+ closing_line: Поздрави
+ ps: 'P.S. Всички Ваши коментари се съхраняват от Refinery в секция "Блог" в подменю "Коментари" и могат да бъдат прегледани по-късно.'
+ shared:
+ categories:
+ title: Категории
+ rss_feed:
+ title: RSS хранилка
+ subscribe: Абониране
+ posts:
+ other: Други публикации
+ created_at: 'Публикувано на %{when}'
+ read_more: Цялата публикация
+ comments:
+ singular: коментар
+ none: няма коментари
+ archives: Архиви
+ tags:
+ title: "Етикети"
+ categories:
+ show:
+ no_posts: Тук все още няма публикации.
+ posts:
+ post:
+ filed_in: Категория
+ comment: коментар
+ comments:
+ by: 'Публикувано от %{who}'
+ time_ago: 'преди %{time}'
+ thank_you: 'Благодаря за Вашия коментар.'
+ thank_you_moderated: 'Благодаря за Вашия коментар. Съобщението Ви е в опашката за модерация и скоро ще бъде показано.'
+ index:
+ no_blog_articles_yet: Все още няма публикувани статии. Очаквайте скоро.
+ show:
+ blog_home: Обратно към началото на блога
+ comments:
+ title: Коментари
+ add: Вашият коментар
+ other: Други публикации
+ filed_in: Категория
+ tagged: Отбелязано с
+ submit: Изпращане на коментар
+ name: Име
+ email: Е-поща
+ message: Съобщение
+ by: от
+ tagged:
+ no_blog_articles_yet: Все още няма публикувани статии. Очаквайте скоро.
+ posts_tagged: Публикации отбелязани с
+ archive:
+ blog_archive_for: 'Архив на блога за %{date}'
+ no_blog_articles_posted: 'Все още няма публикувани статии за %{date}. Очаквайте скоро.'
+ activerecord:
+ models:
+ blog_category: Категория
+ blog_comment: Коментар
+ blog_post: Публикация
+ attributes:
+ blog_category:
+ title: Заглавие
+ blog_comment:
+ name: Име
+ email: Е-поща
+ message: Съобщение
+ blog_post:
+ title: Заглавие
+ body: Съдържание
+ teaser: Извадка
diff --git a/config/locales/en.yml b/config/locales/en.yml
index a14f18c..1510258 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -155,3 +155,4 @@ en:
blog_post:
title: Title
body: Body
+ teaser: Teaser
diff --git a/config/routes.rb b/config/routes.rb
index 5eb899a..aed7e77 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -6,7 +6,7 @@
match 'categories/:id', :to => 'categories#show', :as => 'blog_category'
match ':id/comments', :to => 'posts#comment', :as => 'blog_post_blog_comments'
get 'archive/:year(/:month)', :to => 'posts#archive', :as => 'archive_blog_posts'
- get 'tagged/:tag_id-:tag_name' => 'posts#tagged', :as => 'tagged_posts'
+ get 'tagged/:tag_id(/:tag_name)' => 'posts#tagged', :as => 'tagged_posts'
end
scope(:path => 'refinery', :as => 'admin', :module => 'admin') do
diff --git a/features/category.feature b/features/category.feature
index 14ec93e..6af1075 100644
--- a/features/category.feature
+++ b/features/category.feature
@@ -19,5 +19,5 @@ Feature: Blog Post Categories
And I press "Save"
Then there should be 1 blog post
- And the blog post should have "1" category
+ And the blog post should have 1 category
And the blog post should have the category "Videos" \ No newline at end of file
diff --git a/features/support/factories/blog_comments.rb b/features/support/factories/blog_comments.rb
index af364be..9405c42 100644
--- a/features/support/factories/blog_comments.rb
+++ b/features/support/factories/blog_comments.rb
@@ -4,5 +4,5 @@ Factory.define(:blog_comment) do |f|
f.name "Joe Commenter"
f.sequence(:email) { |n| "person#{n}@example.com" }
f.body "Which one is the best for picking up new shoes?"
- f.association :post
+ f.association :post, :factory => :blog_post
end
diff --git a/features/support/factories/blog_posts.rb b/features/support/factories/blog_posts.rb
index 33f6b93..4584fec 100644
--- a/features/support/factories/blog_posts.rb
+++ b/features/support/factories/blog_posts.rb
@@ -1,6 +1,6 @@
require 'factory_girl'
-Factory.define(:post, :class => BlogPost) do |f|
+Factory.define(:blog_post, :class => BlogPost) do |f|
f.sequence(:title) { |n| "Top #{n} Shopping Centers in Chicago" }
f.body "These are the top ten shopping centers in Chicago. You're going to read a long blog post about them. Come to peace with it."
f.draft false
diff --git a/features/support/step_definitions/category_steps.rb b/features/support/step_definitions/category_steps.rb
index 31176b4..891b5c0 100644
--- a/features/support/step_definitions/category_steps.rb
+++ b/features/support/step_definitions/category_steps.rb
@@ -1,11 +1,11 @@
Given /^there is a category titled "([^"]*)"$/ do |title|
- @category = Factory(:blog_category, :title => title)
+ @category = Factory.create(:blog_category, :title => title)
end
-Then /^the blog post should have "([^"]*)" category$/ do |num_category|
- BlogPost.last.categories.count.should == num_category
+Then /^the blog post should have ([\d]*) categor[yies]{1,3}$/ do |num_category|
+ BlogPost.last.categories.count.should == num_category.to_i
end
-Then /^the blog post should have the category "([^"]*)"$/ do |category|
+Then /^the blog post should have the category "([^"]*)"$/ do |category|
BlogPost.last.categories.first.title.should == category
end \ No newline at end of file
diff --git a/features/support/step_definitions/tags_steps.rb b/features/support/step_definitions/tags_steps.rb
index a99b5d6..8280474 100644
--- a/features/support/step_definitions/tags_steps.rb
+++ b/features/support/step_definitions/tags_steps.rb
@@ -1,8 +1,10 @@
Given /^there is a blog post titled "([^"]*)" and tagged "([^"]*)"$/ do |title, tag_name|
- @blog_post = Factory(:post, :title => title, :tag_list => tag_name)
+ @blog_post = Factory.create(:blog_post, :title => title, :tag_list => tag_name)
end
When /^I visit the tagged posts page for "([^"]*)"$/ do |tag_name|
+ @blog_post ||= Factory.create(:blog_post, :tag_list => tag_name)
+ tag = BlogPost.tag_counts_on(:tags).first
visit tagged_posts_path(tag.id, tag_name.parameterize)
end
diff --git a/lib/gemspec.rb b/lib/gemspec.rb
index 25f9157..3562315 100644
--- a/lib/gemspec.rb
+++ b/lib/gemspec.rb
@@ -2,9 +2,7 @@
require File.expand_path('../refinery/blog/version', __FILE__)
version = ::Refinery::Blog::Version.to_s
raise "Could not get version so gemspec can not be built" if version.nil?
-files = Dir.glob("**/*").flatten.reject do |file|
- file =~ /\.gem(spec)?$/
-end
+files = Dir.glob("**/*").flatten.reject{|f| f =~ %r{.gem$}}
gemspec = <<EOF
Gem::Specification.new do |s|
@@ -19,7 +17,7 @@ Gem::Specification.new do |s|
s.require_paths = %w(lib)
# Runtime dependencies
- s.add_dependency 'refinerycms-core', '~> 1.0.0'
+ s.add_dependency 'refinerycms-core', '~> 1.0.3'
s.add_dependency 'filters_spam', '~> 0.2'
s.add_dependency 'acts-as-taggable-on'
s.add_dependency 'seo_meta', '~> 1.1.0'
diff --git a/lib/refinery/blog/version.rb b/lib/refinery/blog/version.rb
index 62e3490..0390414 100644
--- a/lib/refinery/blog/version.rb
+++ b/lib/refinery/blog/version.rb
@@ -3,7 +3,7 @@ module Refinery
class Version
@major = 1
@minor = 6
- @tiny = 1
+ @tiny = 2
class << self
attr_reader :major, :minor, :tiny
diff --git a/lib/refinerycms-blog.rb b/lib/refinerycms-blog.rb
index 752cba3..7100c99 100644
--- a/lib/refinerycms-blog.rb
+++ b/lib/refinerycms-blog.rb
@@ -34,22 +34,6 @@ module Refinery
:class => BlogPost
}
end
-
- # refinery 0.9.8 had a bug that we later found through using this engine.
- # the bug was that the plugin urls were not :controller => '/admin/whatever'
- if Refinery.version == '0.9.8'
- ::Refinery::Plugin.class_eval do
- alias_method :old_url, :url
-
- def url
- if (plugin_url = self.old_url).is_a?(Hash) and plugin_url[:controller] =~ %r{^admin}
- plugin_url[:controller] = "/#{plugin_url[:controller]}"
- end
-
- plugin_url
- end
- end
- end
end
end if defined?(Rails::Engine)
end
diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec
index 2d78207..51682fb 100644
--- a/refinerycms-blog.gemspec
+++ b/refinerycms-blog.gemspec
@@ -1,8 +1,8 @@
Gem::Specification.new do |s|
s.name = %q{refinerycms-blog}
- s.version = %q{1.6.1}
+ s.version = %q{1.6.2}
s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.}
- s.date = %q{2011-06-22}
+ s.date = %q{2011-06-29}
s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.}
s.email = %q{info@refinerycms.com}
s.homepage = %q{http://refinerycms.com/blog}
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
s.require_paths = %w(lib)
# Runtime dependencies
- s.add_dependency 'refinerycms-core', '~> 1.0.0'
+ s.add_dependency 'refinerycms-core', '~> 1.0.3'
s.add_dependency 'filters_spam', '~> 0.2'
s.add_dependency 'acts-as-taggable-on'
s.add_dependency 'seo_meta', '~> 1.1.0'
@@ -66,6 +66,7 @@ Gem::Specification.new do |s|
app/views/admin/blog/posts/_form_part.html.erb
app/views/admin/blog/posts/_post.html.erb
app/views/admin/blog/posts/_sortable_list.html.erb
+ app/views/admin/blog/posts/_teaser_part.html.erb
app/views/admin/blog/posts/edit.html.erb
app/views/admin/blog/posts/index.html.erb
app/views/admin/blog/posts/new.html.erb
@@ -120,6 +121,7 @@ Gem::Specification.new do |s|
db/migrate/4_create_seo_meta_for_blog.rb
db/migrate/5_add_cached_slugs.rb
db/migrate/6_add_custom_url_field_to_blog_posts.rb
+ db/migrate/7_add_custom_teaser_field_to_blog_posts.rb
db/seeds
db/seeds/refinerycms_blog.rb
features
@@ -189,6 +191,7 @@ Gem::Specification.new do |s|
public/stylesheets/ui-lightness/images/ui-icons_ffffff_256x240.png
public/stylesheets/ui-lightness/jquery-ui-1.8.13.custom.css
readme.md
+ refinerycms-blog.gemspec
spec
spec/models
spec/models/blog_category_spec.rb
diff --git a/spec/models/blog_category_spec.rb b/spec/models/blog_category_spec.rb
index 8ddec46..7792744 100644
--- a/spec/models/blog_category_spec.rb
+++ b/spec/models/blog_category_spec.rb
@@ -3,7 +3,7 @@ Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each
describe BlogCategory do
before(:each) do
- @blog_category = Factory(:blog_category)
+ @blog_category = Factory.create(:blog_category)
end
describe "validations" do
@@ -20,20 +20,20 @@ describe BlogCategory do
it "has a posts attribute" do
@blog_category.should respond_to(:posts)
end
-
+
it "returns posts by published_at date in descending order" do
first_post = @blog_category.posts.create!({ :title => "Breaking News: Joe Sak is hot stuff you guys!!", :body => "True story.", :published_at => Time.now.yesterday })
- latest_post = @blog_category.posts.create!({ :title => "parndt is p. okay", :body => "For a kiwi.", :published_at => Time.now })
+ latest_post = @blog_category.posts.create!({ :title => "parndt is p. okay", :body => "For a Kiwi.", :published_at => Time.now })
@blog_category.posts.first.should == latest_post
end
-
+
end
describe "#post_count" do
it "returns post count in category" do
2.times do
- @blog_category.posts << Factory(:post)
+ @blog_category.posts << Factory.create(:blog_post)
end
@blog_category.post_count.should == 2
end
diff --git a/spec/models/blog_comment_spec.rb b/spec/models/blog_comment_spec.rb
index a7c1d33..feb2860 100644
--- a/spec/models/blog_comment_spec.rb
+++ b/spec/models/blog_comment_spec.rb
@@ -6,7 +6,7 @@ describe BlogComment do
context "wiring up" do
before(:each) do
- @comment = Factory(:blog_comment)
+ @comment = Factory.create(:blog_comment)
end
it "saves" do
diff --git a/spec/models/blog_post_spec.rb b/spec/models/blog_post_spec.rb
index 123fe9d..5642446 100644
--- a/spec/models/blog_post_spec.rb
+++ b/spec/models/blog_post_spec.rb
@@ -2,19 +2,19 @@ require 'spec_helper'
Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory}
describe BlogPost do
- let(:blog_post ) { Factory :post }
-
+ let(:blog_post ) { Factory.create(:blog_post) }
+
describe "validations" do
it "requires title" do
- Factory.build(:post, :title => "").should_not be_valid
+ Factory.build(:blog_post, :title => "").should_not be_valid
end
it "won't allow duplicate titles" do
- Factory.build(:post, :title => blog_post.title).should_not be_valid
+ Factory.build(:blog_post, :title => blog_post.title).should_not be_valid
end
it "requires body" do
- Factory.build(:post, :body => nil).should_not be_valid
+ Factory.build(:blog_post, :body => nil).should_not be_valid
end
end
@@ -25,7 +25,7 @@ describe BlogPost do
end
it "destroys associated comments" do
- Factory(:blog_comment, :blog_post_id => blog_post.id)
+ Factory.create(:blog_comment, :blog_post_id => blog_post.id)
blog_post.destroy
BlogComment.find_by_blog_post_id(blog_post.id).should == nil
end
@@ -36,16 +36,16 @@ describe BlogPost do
blog_post.should respond_to(:categories)
end
end
-
+
describe "tags" do
it "acts as taggable" do
blog_post.should respond_to(:tag_list)
-
+
#the factory has default tags, including 'chicago'
blog_post.tag_list.should include("chicago")
end
end
-
+
describe "authors" do
it "are authored" do
BlogPost.instance_methods.map(&:to_sym).should include(:author)
@@ -54,11 +54,11 @@ describe BlogPost do
describe "by_archive scope" do
before do
- @blog_post1 = Factory(:post, :published_at => Date.new(2011, 3, 11))
- @blog_post2 = Factory(:post, :published_at => Date.new(2011, 3, 12))
-
+ @blog_post1 = Factory.create(:blog_post, :published_at => Date.new(2011, 3, 11))
+ @blog_post2 = Factory.create(:blog_post, :published_at => Date.new(2011, 3, 12))
+
#2 months before
- Factory(:post, :published_at => Date.new(2011, 1, 10))
+ Factory.create(:blog_post, :published_at => Date.new(2011, 1, 10))
end
it "returns all posts from specified month" do
@@ -71,9 +71,9 @@ describe BlogPost do
describe "all_previous scope" do
before do
- @blog_post1 = Factory(:post, :published_at => Time.now - 2.months)
- @blog_post2 = Factory(:post, :published_at => Time.now - 1.month)
- Factory :post, :published_at => Time.now
+ @blog_post1 = Factory.create(:blog_post, :published_at => Time.now - 2.months)
+ @blog_post2 = Factory.create(:blog_post, :published_at => Time.now - 1.month)
+ Factory.create(:blog_post, :published_at => Time.now)
end
it "returns all posts from previous months" do
@@ -84,10 +84,10 @@ describe BlogPost do
describe "live scope" do
before do
- @blog_post1 = Factory(:post, :published_at => Time.now.advance(:minutes => -2))
- @blog_post2 = Factory(:post, :published_at => Time.now.advance(:minutes => -1))
- Factory(:post, :draft => true)
- Factory(:post, :published_at => Time.now + 1.minute)
+ @blog_post1 = Factory.create(:blog_post, :published_at => Time.now.advance(:minutes => -2))
+ @blog_post2 = Factory.create(:blog_post, :published_at => Time.now.advance(:minutes => -1))
+ Factory.create(:blog_post, :draft => true)
+ Factory.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
@@ -98,10 +98,10 @@ describe BlogPost do
describe "uncategorized scope" do
before do
- @uncategorized_blog_post = Factory(:post)
- @categorized_blog_post = Factory(:post)
+ @uncategorized_blog_post = Factory.create(:blog_post)
+ @categorized_blog_post = Factory.create(:blog_post)
- @categorized_blog_post.categories << Factory(:blog_category)
+ @categorized_blog_post.categories << Factory.create(:blog_category)
end
it "returns uncategorized posts if they exist" do
@@ -112,22 +112,22 @@ describe BlogPost do
describe "#live?" do
it "returns true if post is not in draft and it's published" do
- Factory(:post).live?.should be_true
+ Factory.create(:blog_post).live?.should be_true
end
it "returns false if post is in draft" do
- Factory(:post, :draft => true).live?.should be_false
+ Factory.create(:blog_post, :draft => true).live?.should be_false
end
it "returns false if post pub date is in future" do
- Factory(:post, :published_at => Time.now.advance(:minutes => 1)).live?.should be_false
+ Factory.create(:blog_post, :published_at => Time.now.advance(:minutes => 1)).live?.should be_false
end
end
describe "#next" do
before do
- Factory(:post, :published_at => Time.now.advance(:minutes => -1))
- @blog_post = Factory(:post)
+ Factory.create(:blog_post, :published_at => Time.now.advance(:minutes => -1))
+ @blog_post = Factory.create(:blog_post)
end
it "returns next article when called on current article" do
@@ -137,8 +137,8 @@ describe BlogPost do
describe "#prev" do
before do
- Factory(:post)
- @blog_post = Factory(:post, :published_at => Time.now.advance(:minutes => -1))
+ Factory.create(:blog_post)
+ @blog_post = Factory.create(:blog_post, :published_at => Time.now.advance(:minutes => -1))
end
it "returns previous article when called on current article" do
@@ -148,9 +148,9 @@ describe BlogPost do
describe "#category_ids=" do
before do
- @cat1 = Factory(:blog_category, :id => 1)
- @cat2 = Factory(:blog_category, :id => 2)
- @cat3 = Factory(:blog_category, :id => 3)
+ @cat1 = Factory.create(:blog_category, :id => 1)
+ @cat2 = Factory.create(:blog_category, :id => 2)
+ @cat3 = Factory.create(:blog_category, :id => 3)
blog_post.category_ids = [1,2,"","",3]
end
@@ -168,7 +168,7 @@ describe BlogPost do
before do
RefinerySetting.set(:comments_allowed, { :scoping => 'blog', :value => true })
end
-
+
it "should be true" do
BlogPost.comments_allowed?.should be_true
end
@@ -178,16 +178,16 @@ describe BlogPost do
before do
RefinerySetting.set(:comments_allowed, { :scoping => 'blog', :value => false })
end
-
+
it "should be false" do
BlogPost.comments_allowed?.should be_false
end
end
end
-
+
describe "custom teasers" do
it "should allow a custom teaser" do
- Factory.build(:blog_post, :custom_teaser => 'This is some custom content').should be_valid
+ Factory.create(:blog_post, :custom_teaser => 'This is some custom content').should be_valid
end
end
end
diff --git a/todo.md b/todo.md
new file mode 100644
index 0000000..f32af48
--- /dev/null
+++ b/todo.md
@@ -0,0 +1,5 @@
+## Why not, let's get this list going, eh?
+
+* Replace comments with disqus?
+* Facebook/twitter login for comments?
+* What else? Add your ideas... \ No newline at end of file