From e11dedec034c4180985adf4a9f176b07121f0a41 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Wed, 4 Jul 2018 11:46:13 -0400 Subject: Blog drafts no longer require slugs They do still technically require titles, but the engine will fill in "Untitled draft" if it is left blank. Unpublished posts can be viewed at a different URL than published posts would be. Quick links to view published and unpublished posts have been added to the admin panel. refs #1 --- app/controllers/admin/blogs_controller.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'app/controllers/admin/blogs_controller.rb') diff --git a/app/controllers/admin/blogs_controller.rb b/app/controllers/admin/blogs_controller.rb index 9706df3..1035c12 100644 --- a/app/controllers/admin/blogs_controller.rb +++ b/app/controllers/admin/blogs_controller.rb @@ -9,6 +9,16 @@ class Admin::BlogsController < Admin::AdminController @blogs = Blog.where(published: false).order(updated_at: :desc) end + def show + @blog = Blog.find(params[:id]) + + if @blog.published + redirect_to blog_url(@blog.slug) + else + render layout: "application" + end + end + def new @blog = Blog.new end -- cgit 1.4.1