Class: Cms::DynamicViewsController

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

Instance Method Summary collapse

Methods included from AdminTab

#new_button_path

Methods inherited from BaseController

allow_guests_to

Methods inherited from ApplicationController

#no_browser_caching

Instance Method Details

#createObject



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

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

#destroyObject



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

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

#indexObject



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

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

#newObject



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

def new
  @view = dynamic_view_type.new_with_defaults
end

#showObject



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

def show
  redirect_to [:edit, @view]
end

#updateObject



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

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