aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Arndt <parndt@gmail.com>2010-11-23 12:21:40 +1300
committerPhilip Arndt <parndt@gmail.com>2010-11-23 12:21:40 +1300
commit9b7cc770a2b6df6d947af3386fe99b9d1a97d648 (patch)
treeca490701c989244964cd1ed36b63eb18365dc687
parent97101633ca5f0a94560d18adc0df41ca8f60eed7 (diff)
downloadrefinerycms-blog-9b7cc770a2b6df6d947af3386fe99b9d1a97d648.tar.gz
refinerycms-blog-9b7cc770a2b6df6d947af3386fe99b9d1a97d648.tar.bz2
refinerycms-blog-9b7cc770a2b6df6d947af3386fe99b9d1a97d648.zip
Allow refinery users with access to the blog to see the blog posts when they are draft. Closes GH-19
-rw-r--r--app/controllers/blog/posts_controller.rb8
-rw-r--r--app/views/blog/posts/_post.html.erb1
2 files changed, 8 insertions, 1 deletions
diff --git a/app/controllers/blog/posts_controller.rb b/app/controllers/blog/posts_controller.rb
index 8dd8ada..5de6984 100644
--- a/app/controllers/blog/posts_controller.rb
+++ b/app/controllers/blog/posts_controller.rb
@@ -73,7 +73,13 @@ class Blog::PostsController < BlogController
protected
def find_blog_post
- @blog_post = BlogPost.live.find(params[:id])
+ 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
def find_all_blog_posts
diff --git a/app/views/blog/posts/_post.html.erb b/app/views/blog/posts/_post.html.erb
index b3efbe9..6fb8e64 100644
--- a/app/views/blog/posts/_post.html.erb
+++ b/app/views/blog/posts/_post.html.erb
@@ -26,6 +26,7 @@
<span class="st_sharethis" displayText="ShareThis"></span>
<% end %>
</article>
+<%= render :partial => '/shared/draft_page_message' unless @blog_post.nil? or @blog_post.live? -%>
<% if next_or_previous?(@blog_post) -%>
<nav id="next_prev_article">
<%= render 'nav' %>