Class: Cms::DynamicViewsController

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

Instance Method Summary collapse

Methods included from PageHelper

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

Methods included from PathHelper

#attachment_path_for, #cms_connectable_path, #cms_index_path_for, #cms_index_url_for, #cms_new_path_for, #cms_new_url_for, #cms_sortable_column_path, #edit_cms_connectable_path, #engine_for, #link_to_usages, #path_elements_for

Methods included from ErrorHandling

#handle_access_denied, #handle_server_error, #with_format

Instance Method Details

#createObject


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

def create
  @view = dynamic_view_type.new(params[view_param_name])
  if @view.save
    flash[:notice] = "#{dynamic_view_type} '#{@view.name}' was created"
    redirect_to cms_index_path_for(dynamic_view_type)
  else
    render :action => "new"
  end
end

#destroyObject


43
44
45
46
47
# File 'app/controllers/cms/dynamic_views_controller.rb', line 43

def destroy
  @view.destroy
  flash[:notice] = "#{dynamic_view_type} '#{@view.name}' was deleted"
  redirect_to cms_index_path_for(dynamic_view_type)
end

#indexObject


12
13
14
# File 'app/controllers/cms/dynamic_views_controller.rb', line 12

def index
  @views = dynamic_view_type.paginate(:page => params[:page], :order => "name")
end

#newObject


16
17
18
# File 'app/controllers/cms/dynamic_views_controller.rb', line 16

def new
  @view = dynamic_view_type.new_with_defaults
end

#showObject


30
31
32
# File 'app/controllers/cms/dynamic_views_controller.rb', line 30

def show
  redirect_to [:edit, @view]
end

#updateObject


34
35
36
37
38
39
40
41
# File 'app/controllers/cms/dynamic_views_controller.rb', line 34

def update
  if @view.update_attributes(params[view_param_name])
    flash[:notice] = "#{dynamic_view_type} '#{@view.name}' was updated"
    redirect_to cms_index_path_for(dynamic_view_type)
  else
    render :action => "edit"
  end
end