Class: Admin::FestivityCategoryTypesController

Inherits:
ResourceController
  • Object
show all
Defined in:
app/controllers/admin/festivity_category_types_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/admin/festivity_category_types_controller.rb', line 11

def create
  site = Site.find(params[:site_id])
  new_category_type = site.festivity_category_types.new(name: params[:name], page_class: params[:page_class])
  if new_category_type.save
    render partial: 'admin/sites/partials/new_category_type', :locals => { :new_category_type => new_category_type, :category_types => site.festivity_active_category_types}
  else
    render status: :conflict, text: "Category Type name must be unique."
  end

end

#destroyObject



22
23
24
25
26
27
28
29
# File 'app/controllers/admin/festivity_category_types_controller.rb', line 22

def destroy
  category_type = FestivityCategoryType.find(params[:id])
  site = Site.find(category_type.site_id)
  category_type.inactive = true
  if category_type.save!
    render partial: 'admin/sites/partials/category_types', :locals => { :category_types => site.festivity_active_category_types}
  end
end

#indexObject



3
4
5
# File 'app/controllers/admin/festivity_category_types_controller.rb', line 3

def index

end

#showObject



7
8
9
# File 'app/controllers/admin/festivity_category_types_controller.rb', line 7

def show

end