Class: GacoCms::Admin::PageTypesController

Inherits:
BaseController show all
Defined in:
app/controllers/gaco_cms/admin/page_types_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#upload_file

Instance Method Details

#createObject



18
19
20
21
22
23
24
25
# File 'app/controllers/gaco_cms/admin/page_types_controller.rb', line 18

def create
  page_type = PageType.new(page_type_params)
  if page_type.save
    redirect_to url_for(action: :index), notice: 'PageType saved'
  else
    render inline: page_type.errors.full_message.join(', ')
  end
end

#destroyObject



39
40
41
42
# File 'app/controllers/gaco_cms/admin/page_types_controller.rb', line 39

def destroy
  @page_type.destroy!
  redirect_to url_for(action: :index), notice: 'PageType destroyed'
end

#editObject



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

def edit
  render :form
end

#indexObject



9
10
11
# File 'app/controllers/gaco_cms/admin/page_types_controller.rb', line 9

def index
  @page_types = PageType.all.title_ordered
end

#newObject



13
14
15
16
# File 'app/controllers/gaco_cms/admin/page_types_controller.rb', line 13

def new
  @page_type = PageType.new
  render :form
end

#updateObject



31
32
33
34
35
36
37
# File 'app/controllers/gaco_cms/admin/page_types_controller.rb', line 31

def update
  if @page_type.update(page_type_params)
    redirect_to url_for(action: :index), notice: 'PageType saved'
  else
    render inline: @page_type.errors.full_message.join(', ')
  end
end