Class: Goldberg::ControllerActionsController

Inherits:
ApplicationController show all
Includes:
Controller
Defined in:
lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/controller_actions_controller.rb

Instance Method Summary collapse

Methods included from Controller

included

Methods included from Six::Import::Controller::ClassMethods

#copy, #six_local_auto_login

Methods inherited from ActionController::Base

#active_scaffold_render_secure_download, #assign_names_with_active_scaffold, #render_with_active_scaffold, #search_generic_view_paths?

Instance Method Details

#createObject



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/controller_actions_controller.rb', line 49

def create
  if params[:controller_action][:specific_name] and 
      params[:controller_action][:specific_name].length > 0
    params[:controller_action][:name] = 
      params[:controller_action][:specific_name]
  end
  @controller_action = ControllerAction.new(params[:controller_action])
  if @controller_action.save
    flash[:notice] = 'ControllerAction was successfully created.'
    Role.rebuild_cache
    redirect_to :controller => 'site_controllers', :action => 'show',
    :id => @controller_action.site_controller_id
  else
    foreign
    render :action => 'new'
  end
end

#destroyObject



88
89
90
91
92
93
94
95
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/controller_actions_controller.rb', line 88

def destroy
  @controller_action = ControllerAction.find(params[:id])
  site_controller_id = @controller_action.site_controller_id
  @controller_action.destroy
  Role.rebuild_cache
  redirect_to :controller => 'site_controllers', :action => 'show',
  :id => @controller_action.site_controller_id
end

#editObject



68
69
70
71
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/controller_actions_controller.rb', line 68

def edit
  @controller_action = ControllerAction.find(params[:id])
  foreign
end

#indexObject



10
11
12
13
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/controller_actions_controller.rb', line 10

def index
  list
  render :action => 'list'
end

#listObject



16
17
18
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/controller_actions_controller.rb', line 16

def list
  @controller_actions = ControllerAction.find(:all, :order => 'name')
end

#newObject



31
32
33
34
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/controller_actions_controller.rb', line 31

def new
  @controller_action = ControllerAction.new
  foreign
end

#new_forObject



37
38
39
40
41
42
43
44
45
46
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/controller_actions_controller.rb', line 37

def new_for
  @controller_action = ControllerAction.new
  @controller_action.site_controller_id = params[:id]
  @site_controller = SiteController.find(params[:id])
  if @site_controller
    @actions = class_actions(@site_controller.name)
  end
  foreign
  render :action => 'new'
end

#showObject



21
22
23
24
25
26
27
28
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/controller_actions_controller.rb', line 21

def show
  @controller_action = ControllerAction.find(params[:id])
  if @controller_action.permission_id
    @permission = Permission.find(@controller_action.permission_id)
  else
    @permission = Permission.new(:id => nil, :name => '(default)')
  end
end

#updateObject



74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/controller_actions_controller.rb', line 74

def update
  @controller_action = ControllerAction.find(params[:id])
  if @controller_action.update_attributes(params[:controller_action])
    flash[:notice] = 'ControllerAction was successfully updated.'
    Role.rebuild_cache
    redirect_to :controller => 'site_controllers', :action => 'show',
    :id => @controller_action.site_controller_id
  else
    foreign
    render :action => 'edit'
  end
end