Class: EngineRoom::SectionsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/engine_room/sections_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /section



41
42
43
44
45
46
47
48
49
50
# File 'app/controllers/engine_room/sections_controller.rb', line 41

def create
  @section = Section.new(params[:section])
  if @section.save
    flash[:notice] = 'Section was successfully created.'
    redirect_to :action => :index
  else
    add_crumb('Create New Section', new_engine_room_section_path)
    render :action => :new
  end
end

#destroyObject

DELETE /section/1



65
66
67
68
69
70
71
# File 'app/controllers/engine_room/sections_controller.rb', line 65

def destroy
  @section = Section.find(params[:id])
  @section.destroy

  flash[:notice] = 'Section was successfully deleted.'
  redirect_to :action => :index
end

#editObject

GET /section/1/edit



35
36
37
38
# File 'app/controllers/engine_room/sections_controller.rb', line 35

def edit
  @section = Section.find(params[:id])
  add_crumb(@section.name.titleize, edit_engine_room_section_path(params[:id]))
end

#indexObject

GET /section_configs



17
18
19
20
# File 'app/controllers/engine_room/sections_controller.rb', line 17

def index
  @sections = Section.order('sort_order ASC')
  # index.html.erb
end

#init_sectionsObject



11
12
13
14
# File 'app/controllers/engine_room/sections_controller.rb', line 11

def init_sections
  @sections = Section.order('sort_order ASC')
  @layout = 'columns'
end

#newObject

GET /section_config/new



29
30
31
32
# File 'app/controllers/engine_room/sections_controller.rb', line 29

def new
  @section = Section.new
  add_crumb 'Create New Section'
end

#showObject

GET /section_config/1



23
24
25
26
# File 'app/controllers/engine_room/sections_controller.rb', line 23

def show
  @section = Section.find(params[:id])
  # show.html.erb
end

#updateObject

PUT /section/1



53
54
55
56
57
58
59
60
61
62
# File 'app/controllers/engine_room/sections_controller.rb', line 53

def update
  @section = Section.find(params[:id])
  if @section.update_attributes(params[:section])
    flash[:notice] = 'Section was successfully updated.'
    redirect_to :action => :index
  else
    add_crumb(@section.name.titleize, edit_engine_room_section_path(params[:id]))
    render :action => :edit
  end
end