Class: Admin::PostGroupsController

Inherits:
AdminController
  • Object
show all
Includes:
EntityPriority, ToggleableEntity
Defined in:
app/controllers/admin/post_groups_controller.rb

Overview

Administrative part of post group management

Instance Method Summary collapse

Instance Method Details

#add_categoryObject

put /admin/post_groups/:id/categories/:category_id



20
21
22
23
24
# File 'app/controllers/admin/post_groups_controller.rb', line 20

def add_category
  @entity.add_category(PostCategory.find_by(id: params[:category_id]))

  head :no_content
end

#add_tagObject

put /admin/post_groups/:id/tags/:tag_id



39
40
41
42
43
# File 'app/controllers/admin/post_groups_controller.rb', line 39

def add_tag
  @entity.add_tag(PostTag.find_by(id: params[:tag_id]))

  head :no_content
end

#indexObject

get /admin/post_groups



11
12
13
# File 'app/controllers/admin/post_groups_controller.rb', line 11

def index
  @collection = PostGroup.list_for_administration
end

#remove_categoryObject

delete /admin/post_groups/:id/categories/:category_id



32
33
34
35
36
# File 'app/controllers/admin/post_groups_controller.rb', line 32

def remove_category
  @entity.remove_category(PostCategory.find_by(id: params[:category_id]))

  head :no_content
end

#remove_tagObject

delete /admin/post_groups/:id/tags/:tag_id



46
47
48
49
50
# File 'app/controllers/admin/post_groups_controller.rb', line 46

def remove_tag
  @entity.remove_tag(PostTag.find_by(id: params[:tag_id]))

  head :no_content
end

#showObject

get /admin/post_groups/:id



16
17
# File 'app/controllers/admin/post_groups_controller.rb', line 16

def show
end

#tagsObject

get /admin/post_groups/:id/tags?q=



27
28
29
# File 'app/controllers/admin/post_groups_controller.rb', line 27

def tags
  @collection = PostTag.with_name_like(params[:q]).list_for_administration.first(50)
end