Class: Cms::PageRouteOptionsController

Inherits:
BaseController show all
Defined in:
app/controllers/cms/page_route_options_controller.rb

Instance Method Summary collapse

Methods included from PageHelper

#able_to?, #cms_toolbar, #container, #container_has_block?, #current_page, #page_title, #render_breadcrumbs, #render_portlet

Methods included from PathHelper

#cms_connectable_path, #cms_index_path_for, #cms_index_url_for, #cms_new_path_for, #cms_new_url_for, #edit_cms_connectable_path

Methods included from ErrorHandling

#handle_access_denied, #handle_server_error, included

Instance Method Details

#createObject



10
11
12
13
14
15
16
17
18
# File 'app/controllers/cms/page_route_options_controller.rb', line 10

def create
  @model = resource.new(params[object_name])
  if @model.save
    flash[:notice] = "#{object_name.titleize} added"
    redirect_to cms_page_route_url(@page_route)
  else
    render :action => "new"
  end
end

#destroyObject



29
30
31
32
33
# File 'app/controllers/cms/page_route_options_controller.rb', line 29

def destroy
  @model.destroy
  flash[:notice] = "#{object_name.titleize} deleted"
  redirect_to cms_page_route_url(@page_route)
end

#newObject



6
7
8
# File 'app/controllers/cms/page_route_options_controller.rb', line 6

def new
  @model = resource.new
end

#updateObject



20
21
22
23
24
25
26
27
# File 'app/controllers/cms/page_route_options_controller.rb', line 20

def update
  if @model.update_attributes(params[object_name])
    flash[:notice] = "#{object_name.titleize} updated"
    redirect_to cms_page_route_url(@page_route)
  else
    render :action => "edit"
  end
end