Class: Admin::ViewsController

Inherits:
AdminController
  • Object
show all
Defined in:
app/controllers/admin/views_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



16
17
18
19
20
21
22
23
24
# File 'app/controllers/admin/views_controller.rb', line 16

def create
  add_sid(:view)
  @view = View.new(params[:view])
  if @view.save
    redirect_to [:admin, @view], :notice => "Successfully created view."
  else
    render :action => 'new'
  end
end

#destroyObject



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

def destroy
  @view = View.find_sys_id(_sid, params[:id])
  @view.destroy
  redirect_to admin_views_url, :notice => "Successfully destroyed view."
end

#editObject



26
27
28
# File 'app/controllers/admin/views_controller.rb', line 26

def edit
  @view = View.find_sys_id(_sid, params[:id])
end

#indexObject



4
5
6
# File 'app/controllers/admin/views_controller.rb', line 4

def index
  @views = View.sys(_sid).all
end

#newObject



12
13
14
# File 'app/controllers/admin/views_controller.rb', line 12

def new
  @view = View.new
end

#showObject



8
9
10
# File 'app/controllers/admin/views_controller.rb', line 8

def show
  @view = View.find_sys_id(_sid, params[:id])
end

#updateObject



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

def update
  @view = View.find_sys_id(_sid, params[:id])
  if @view.update_attributes(params[:view])
    redirect_to [:admin, @view], :notice  => "Successfully updated view."
  else
    render :action => 'edit'
  end
end