aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/refinery/blog/admin/settings_controller.rb2
-rw-r--r--app/controllers/refinery/blog/posts_controller.rb2
-rw-r--r--app/models/refinery/blog/post.rb8
3 files changed, 11 insertions, 1 deletions
diff --git a/app/controllers/refinery/blog/admin/settings_controller.rb b/app/controllers/refinery/blog/admin/settings_controller.rb
index 96687ad..68daa19 100644
--- a/app/controllers/refinery/blog/admin/settings_controller.rb
+++ b/app/controllers/refinery/blog/admin/settings_controller.rb
@@ -8,7 +8,7 @@ module Refinery
if request.post?
Refinery::Blog::Comment::Notification.recipients = params[:recipients]
- flash[:notice] = t('updated', :scope => 'admin.blog.settings.notification_recipients',
+ flash[:notice] = t('updated', :scope => 'refinery.blog.admin.settings.notification_recipients',
:recipients => Refinery::Blog::Comment::Notification.recipients)
unless request.xhr? or from_dialog?
redirect_back_or_default(refinery.blog_admin_posts_path)
diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb
index abd60f4..bde3a9c 100644
--- a/app/controllers/refinery/blog/posts_controller.rb
+++ b/app/controllers/refinery/blog/posts_controller.rb
@@ -23,6 +23,8 @@ module Refinery
@comment = Comment.new
@canonical = url_for(:locale => ::Refinery::I18n.default_frontend_locale) if canonical?
+
+ @post.increment!(:access_count, 1)
respond_with (@post) do |format|
format.html { present(@post) }
diff --git a/app/models/refinery/blog/post.rb b/app/models/refinery/blog/post.rb
index dbea93f..ddfc3cc 100644
--- a/app/models/refinery/blog/post.rb
+++ b/app/models/refinery/blog/post.rb
@@ -78,6 +78,14 @@ module Refinery
def live
where( "published_at <= ? and draft = ?", Time.now, false)
end
+
+ def recent(count)
+ live.limit(count)
+ end
+
+ def popular(count)
+ unscoped.order("access_count DESC").limit(count)
+ end
def previous(item)
where(["published_at < ? and draft = ?", item.published_at, false]).limit(1)