Class: Goldberg::SiteControllersController

Inherits:
ApplicationController show all
Includes:
Controller
Defined in:
lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/site_controllers_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



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/site_controllers_controller.rb', line 44

def create
  @site_controller = SiteController.new(params[:site_controller])
  if @site_controller.save
    flash[:notice] = 'SiteController was successfully created.'
    Role.rebuild_cache
    redirect_to :action => 'list'
  else
    foreign
    render :action => 'new'
  end
end

#destroyObject



73
74
75
76
77
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/site_controllers_controller.rb', line 73

def destroy
  SiteController.find(params[:id]).destroy
  Role.rebuild_cache
  redirect_to :action => 'list'
end

#editObject



56
57
58
59
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/site_controllers_controller.rb', line 56

def edit
  @site_controller = SiteController.find(params[:id])
  foreign
end

#indexObject



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

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

#listObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/site_controllers_controller.rb', line 14

def list
  @builtin_site_controllers = SiteController.find(:all,
                                                  :conditions => "builtin = 1",
                                                  :order => 'name')
  @app_site_controllers = 
    SiteController.find(:all,
                        :conditions => "builtin is null or builtin = 0",
                        :order => 'name')
  classify_controllers
end

#newObject



33
34
35
36
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/site_controllers_controller.rb', line 33

def new
  foreign
  @site_controller = SiteController.new
end

#new_calledObject



38
39
40
41
42
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/site_controllers_controller.rb', line 38

def new_called
  foreign
  @site_controller = SiteController.new(:name => params[:id].gsub(/\%2F/, '/'))
  render :action => 'new'
end

#showObject



25
26
27
28
29
30
31
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/site_controllers_controller.rb', line 25

def show
  @site_controller = SiteController.find(params[:id])
  @actions = ControllerAction.find(:all,
                                   :conditions => ['site_controller_id = ?',
                                                   params[:id] ],
                                   :order => 'name')
end

#updateObject



61
62
63
64
65
66
67
68
69
70
71
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/site_controllers_controller.rb', line 61

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