Class: AclsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/acls_controller.rb

Instance Method Summary collapse

Methods included from Zena::App

included

Instance Method Details

#createObject



32
33
34
# File 'app/controllers/acls_controller.rb', line 32

def create
  @acl = secure(Acl) {Acl.create(acl_attributes)}
end

#destroyObject



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'app/controllers/acls_controller.rb', line 51

def destroy
  @acl.destroy

  respond_to do |format|
    format.html do
      if @acl.errors.empty?
        redirect_to :action => 'index'
      else
        render :action => 'edit'
      end
    end
    format.js   do
      render(:partial => 'form') unless @acl.errors.empty?
    end
    format.xml  { head :ok }
  end
end

#editObject



25
26
27
28
29
30
# File 'app/controllers/acls_controller.rb', line 25

def edit
  respond_to do |format|
    format.html
    format.js { render :partial => 'form' }
  end
end

#indexObject



7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/acls_controller.rb', line 7

def index
  secure(Acl) do
    @acls = Acl.paginate(:all, :order => 'action ASC, priority DESC, name ASC', :per_page => 20, :page => params[:page])
  end
  @acl = Acl.new

  respond_to do |format|
    format.html # index.html.erb
  end
end

#showObject



18
19
20
21
22
23
# File 'app/controllers/acls_controller.rb', line 18

def show
  respond_to do |format|
    format.html { render :file => admin_layout, :layout => false }
    format.js
  end
end

#updateObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'app/controllers/acls_controller.rb', line 36

def update
  @acl.update_attributes(acl_attributes)

  respond_to do |format|
    format.html do
      if @acl.errors.empty?
        redirect_to :action => 'show'
      else
        render :action => 'edit'
      end
    end
    format.js
  end
end