app/controllers/spina/admin/conferences/blog/posts_controller.rb in spina-admin-conferences-blog-0.1.4 vs app/controllers/spina/admin/conferences/blog/posts_controller.rb in spina-admin-conferences-blog-0.2.0
- old
+ new
@@ -7,15 +7,15 @@
class PostsController < AdminController
before_action :post, except: %i[index live draft future new create]
before_action :set_breadcrumb
before_action :set_tabs, only: %i[new create edit update]
before_action :set_locale
+
+ admin_section :blog
decorates_assigned :post
- layout 'spina/admin/conferences/blog/blog'
-
def index
@posts = Spina::Admin::Conferences::Blog::Post.order(created_at: :desc)
end
def live
@@ -44,11 +44,11 @@
if @post.save
redirect_to spina.edit_admin_conferences_blog_post_url(@post.id),
notice: t('spina.blog.posts.saved')
else
add_breadcrumb I18n.t('spina.blog.posts.new')
- render :new, layout: 'spina/admin/admin'
+ render :new, status: :unprocessable_entity
end
end
def edit
add_breadcrumb @post.title
@@ -60,10 +60,10 @@
add_breadcrumb @post.title
redirect_to spina.edit_admin_conferences_blog_post_url(
@post.id, params: { locale: @locale }
), notice: t('spina.blog.posts.saved')
else
- render :edit, layout: 'spina/admin/admin'
+ render :edit, status: :unprocessable_entity
end
end
def destroy
@post.destroy