Class: Cms::DynamicViewsController
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
#handle_access_denied, #handle_server_error, included
Instance Method Details
#create ⇒ Object
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(params[dynamic_view_type.name.underscore])
if @view.save
flash[:notice] = I18n.t("controllers.dynamic_view.created", :dynamic_view_type => dynamic_view_type, :name => @view.name)
redirect_to cms_index_path_for(dynamic_view_type.name.underscore.pluralize)
else
render :action => "new"
end
end
|
#destroy ⇒ Object
42
43
44
45
46
|
# File 'app/controllers/cms/dynamic_views_controller.rb', line 42
def destroy
@view.destroy
flash[:notice] = I18n.t("controllers.dynamic_view.deleted", :dynamic_view_type => dynamic_view_type, :name => @view.name)
redirect_to cms_index_path_for(dynamic_view_type.name.underscore.pluralize)
end
|
#index ⇒ Object
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
|
#new ⇒ Object
15
16
17
|
# File 'app/controllers/cms/dynamic_views_controller.rb', line 15
def new
@view = dynamic_view_type.new_with_defaults
end
|
#show ⇒ Object
29
30
31
|
# File 'app/controllers/cms/dynamic_views_controller.rb', line 29
def show
redirect_to [:edit, :cms, @view]
end
|
#update ⇒ Object
33
34
35
36
37
38
39
40
|
# File 'app/controllers/cms/dynamic_views_controller.rb', line 33
def update
if @view.update_attributes(params[dynamic_view_type.name.underscore])
flash[:notice] = I18n.t("controllers.dynamic_view.updated", :dynamic_view_type => dynamic_view_type, :name => @view.name)
redirect_to cms_index_path_for(dynamic_view_type.name.underscore.pluralize)
else
render :action => "edit"
end
end
|