Class: PostGroupsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- PostGroupsController
- Defined in:
- app/controllers/post_groups_controller.rb
Overview
Handling post groups
Instance Method Summary collapse
-
#check ⇒ Object
post /post_groups/check.
-
#create ⇒ Object
post /post_groups.
-
#destroy ⇒ Object
delete /post_groups/:id.
-
#edit ⇒ Object
get /post_groups/:id/edit.
-
#new ⇒ Object
get /post_groups/new.
-
#show ⇒ Object
get /post_groups/:id.
-
#update ⇒ Object
patch /post_groups/:id.
Instance Method Details
#check ⇒ Object
post /post_groups/check
11 12 13 14 15 |
# File 'app/controllers/post_groups_controller.rb', line 11 def check @entity = PostGroup.instance_for_check(params[:entity_id], entity_parameters) render 'shared/forms/check' end |
#create ⇒ Object
post /post_groups
23 24 25 26 27 28 29 30 |
# File 'app/controllers/post_groups_controller.rb', line 23 def create @entity = PostGroup.new(entity_parameters) if @entity.save form_processed_ok(admin_post_group_path(id: @entity.id)) else form_processed_with_error(:new) end end |
#destroy ⇒ Object
delete /post_groups/:id
46 47 48 49 50 |
# File 'app/controllers/post_groups_controller.rb', line 46 def destroy flash[:notice] = t('post_groups.destroy.success') if @entity.destroy redirect_to post_groups_admin_post_type_path(id: @entity.post_type_id) end |
#edit ⇒ Object
get /post_groups/:id/edit
33 34 |
# File 'app/controllers/post_groups_controller.rb', line 33 def edit end |
#new ⇒ Object
get /post_groups/new
18 19 20 |
# File 'app/controllers/post_groups_controller.rb', line 18 def new @entity = PostGroup.new end |
#show ⇒ Object
get /post_groups/:id
53 54 55 56 57 58 59 60 |
# File 'app/controllers/post_groups_controller.rb', line 53 def show @entity = PostGroup.visible.find_by(slug: params[:id]) if @entity.nil? handle_http_404('Cannot find post_group') else @collection = @entity.posts_page(current_page) end end |
#update ⇒ Object
patch /post_groups/:id
37 38 39 40 41 42 43 |
# File 'app/controllers/post_groups_controller.rb', line 37 def update if @entity.update(entity_parameters) form_processed_ok(admin_post_group_path(id: @entity.id)) else form_processed_with_error(:edit) end end |