Class: Pulitzer::PostTypesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Pulitzer::PostTypesController
- Defined in:
- app/controllers/pulitzer/post_types_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #template ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
21 22 23 24 25 |
# File 'app/controllers/pulitzer/post_types_controller.rb', line 21 def create @post_type = Pulitzer::PostType.create(post_type_params) Pulitzer::CreateSingletonPost.new(@post_type).call render partial: 'show_wrapper', locals: {post_type: @post_type} end |
#destroy ⇒ Object
45 46 47 48 |
# File 'app/controllers/pulitzer/post_types_controller.rb', line 45 def destroy @post_type.destroy head :ok end |
#edit ⇒ Object
35 36 37 |
# File 'app/controllers/pulitzer/post_types_controller.rb', line 35 def edit render partial: 'form', locals: {post_type: @post_type} end |
#index ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/controllers/pulitzer/post_types_controller.rb', line 4 def index if params[:post_type_kind] @post_type_kind = params[:post_type_kind] else @post_type_kind = 'template' end if request.xhr? @post_types = Pulitzer::PostType.send(@post_type_kind).order(name: :asc) render_ajax end end |
#new ⇒ Object
16 17 18 19 |
# File 'app/controllers/pulitzer/post_types_controller.rb', line 16 def new @post_type = Pulitzer::PostType.new(post_type_params) render partial: 'new', locals: {post_type: @post_type} end |
#show ⇒ Object
27 28 29 |
# File 'app/controllers/pulitzer/post_types_controller.rb', line 27 def show render partial: 'show', locals: {post_type: @post_type} end |
#template ⇒ Object
31 32 33 |
# File 'app/controllers/pulitzer/post_types_controller.rb', line 31 def template render_ajax locals: {post_type: @post_type} end |
#update ⇒ Object
39 40 41 42 43 |
# File 'app/controllers/pulitzer/post_types_controller.rb', line 39 def update @post_type.update_attributes(post_type_params) Pulitzer::UpdateSingletonPost.new(@post_type, post_params_name).call render partial: 'show', locals: {post_type: @post_type} end |