Class: EtCms::Admin::PagesController

Inherits:
EtCms::AdminController show all
Defined in:
app/controllers/et_cms/admin/pages_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



17
18
19
20
21
22
23
24
25
# File 'app/controllers/et_cms/admin/pages_controller.rb', line 17

def create
  @page = Page.new(params[:page])

  if @page.save
    redirect_to(pages_url, :notice => 'Page was successfully created.')
  else
    render :action => "new"
  end
end

#destroyObject



41
42
43
44
# File 'app/controllers/et_cms/admin/pages_controller.rb', line 41

def destroy
  Page.destroy(params[:id])
  redirect_to(pages_url)
end

#editObject



13
14
15
# File 'app/controllers/et_cms/admin/pages_controller.rb', line 13

def edit
  @page = Page.find(params[:id])
end

#indexObject



5
6
7
# File 'app/controllers/et_cms/admin/pages_controller.rb', line 5

def index
  @pages = Page.all
end

#newObject



9
10
11
# File 'app/controllers/et_cms/admin/pages_controller.rb', line 9

def new
  @page = Page.new
end

#updateObject



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/controllers/et_cms/admin/pages_controller.rb', line 27

def update
  @page = Page.find(params[:id])

  respond_to do |format|
    if @page.update_attributes(params[:page])
      format.html { redirect_to(pages_url, :notice => 'Page was successfully updated.') }
      format.json { head :ok }
    else
      format.html { render :action => "edit" }
      format.json { head :bad_request }
    end
  end
end