Class: Admin::RolesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/admin/roles_controller.rb

Instance Method Summary collapse

Instance Method Details

#activateObject



71
72
73
# File 'app/controllers/admin/roles_controller.rb', line 71

def activate
  @role.activate
end

#add_rightObject



65
66
67
68
69
# File 'app/controllers/admin/roles_controller.rb', line 65

def add_right
  @role.update_attributes(params[:role])
  @role.save
  return redirect_to([forgeos_core, :admin, @role])
end

#createObject



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

def create
  if @role.save
    flash[:notice] = I18n.t('role.create.success').capitalize
    redirect_to [forgeos_core, :edit, :admin, @role]
  else
    flash[:error] = I18n.t('role.create.failed').capitalize
    render :action => "new"
  end
end

#destroyObject



48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'app/controllers/admin/roles_controller.rb', line 48

def destroy
  if @role.destroy
    flash[:notice] = I18n.t('role.destroy.success').capitalize
  else
    flash[:error] = I18n.t('role.destroy.failed').capitalize
  end
  respond_to do |wants|
    wants.html do
      redirect_to([forgeos_core,:admin,:roles])
    end
    wants.js
  end
end

#duplicateObject



21
22
23
24
# File 'app/controllers/admin/roles_controller.rb', line 21

def duplicate
  @role = @role.clone
  render :action => 'new'
end

#editObject



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

def edit
end

#indexObject



5
6
7
8
9
10
11
12
13
# File 'app/controllers/admin/roles_controller.rb', line 5

def index
  respond_to do |format|
    format.html # index.html.erb
    format.json do
      sort
      render :layout => false
    end
  end
end

#newObject



18
19
# File 'app/controllers/admin/roles_controller.rb', line 18

def new
end

#rightsObject



62
63
# File 'app/controllers/admin/roles_controller.rb', line 62

def rights
end

#showObject



15
16
# File 'app/controllers/admin/roles_controller.rb', line 15

def show
end

#updateObject



39
40
41
42
43
44
45
46
# File 'app/controllers/admin/roles_controller.rb', line 39

def update
  if @role.update_attributes(params[:role])
    flash[:notice] = I18n.t('role.update.success').capitalize
  else
    flash[:error] = I18n.t('role.update.failed').capitalize
  end
  render :action => "edit"
end