aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-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
24 files changed, 305 insertions, 274 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>