Class: Spina::Admin::Conferences::Blog::PostsController
- Inherits:
-
AdminController
- Object
- AdminController
- Spina::Admin::Conferences::Blog::PostsController
- Defined in:
- app/controllers/spina/admin/conferences/blog/posts_controller.rb
Overview
Spina::Admin::Conferences::Blog::PostsController
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #draft ⇒ Object
- #edit ⇒ Object
- #future ⇒ Object
- #index ⇒ Object
- #live ⇒ Object
- #new ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'app/controllers/spina/admin/conferences/blog/posts_controller.rb', line 42 def create @post = Spina::Admin::Conferences::Blog::Post.new post_params if @post.save redirect_to spina.edit_admin_conferences_blog_post_url(@post.id), notice: t('spina.blog.posts.saved') else I18n.t('spina.blog.posts.new') render :new, status: :unprocessable_entity end end |
#destroy ⇒ Object
69 70 71 72 |
# File 'app/controllers/spina/admin/conferences/blog/posts_controller.rb', line 69 def destroy @post.destroy redirect_to spina.admin_conferences_blog_posts_path end |
#draft ⇒ Object
26 27 28 29 |
# File 'app/controllers/spina/admin/conferences/blog/posts_controller.rb', line 26 def draft @posts = Spina::Admin::Conferences::Blog::Post.draft.order(created_at: :desc) render :index end |
#edit ⇒ Object
53 54 55 56 |
# File 'app/controllers/spina/admin/conferences/blog/posts_controller.rb', line 53 def edit @post.title render layout: 'spina/admin/admin' end |
#future ⇒ Object
31 32 33 34 |
# File 'app/controllers/spina/admin/conferences/blog/posts_controller.rb', line 31 def future @posts = Spina::Admin::Conferences::Blog::Post.future.order(created_at: :desc) render :index end |
#index ⇒ Object
17 18 19 |
# File 'app/controllers/spina/admin/conferences/blog/posts_controller.rb', line 17 def index @posts = Spina::Admin::Conferences::Blog::Post.order(created_at: :desc) end |
#live ⇒ Object
21 22 23 24 |
# File 'app/controllers/spina/admin/conferences/blog/posts_controller.rb', line 21 def live @posts = Spina::Admin::Conferences::Blog::Post.live.order(created_at: :desc) render :index end |
#new ⇒ Object
36 37 38 39 40 |
# File 'app/controllers/spina/admin/conferences/blog/posts_controller.rb', line 36 def new @post = Spina::Admin::Conferences::Blog::Post.new I18n.t('spina.blog.posts.new') render layout: 'spina/admin/admin' end |
#update ⇒ Object
58 59 60 61 62 63 64 65 66 67 |
# File 'app/controllers/spina/admin/conferences/blog/posts_controller.rb', line 58 def update if @post.update(post_params) @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, status: :unprocessable_entity end end |