Class: Cms::ContentBlockController
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
#handle_access_denied, #handle_server_error, #with_format
Instance Method Details
#create ⇒ Object
31
32
33
34
35
36
37
38
39
40
|
# File 'app/controllers/cms/content_block_controller.rb', line 31
def create
if create_block
after_create_on_success
else
after_create_on_failure
end
rescue Exception => @exception
raise @exception if @exception.is_a?(Cms::Errors::AccessDenied)
after_create_on_error
end
|
#destroy ⇒ Object
60
61
62
63
|
# File 'app/controllers/cms/content_block_controller.rb', line 60
def destroy
do_command("deleted") { @block.destroy }
redirect_to_first params[:_redirect_to], blocks_path
end
|
#edit ⇒ Object
42
43
44
45
|
# File 'app/controllers/cms/content_block_controller.rb', line 42
def edit
load_block_draft
render "#{template_directory}/edit"
end
|
#index ⇒ Object
15
16
17
18
|
# File 'app/controllers/cms/content_block_controller.rb', line 15
def index
load_blocks
render "#{template_directory}/index"
end
|
#new ⇒ Object
25
26
27
28
29
|
# File 'app/controllers/cms/content_block_controller.rb', line 25
def new
build_block
set_default_category
render "#{template_directory}/new"
end
|
#publish ⇒ Object
67
68
69
70
|
# File 'app/controllers/cms/content_block_controller.rb', line 67
def publish
do_command("published") { @block.publish! }
redirect_to_first params[:_redirect_to], block_path(@block)
end
|
#revert_to ⇒ Object
72
73
74
75
76
77
|
# File 'app/controllers/cms/content_block_controller.rb', line 72
def revert_to
do_command("reverted to version #{params[:version]}") do
revert_block(params[:version])
end
redirect_to_first params[:_redirect_to], block_path(@block)
end
|
#show ⇒ Object
20
21
22
23
|
# File 'app/controllers/cms/content_block_controller.rb', line 20
def show
load_block_draft
render "#{template_directory}/show"
end
|
#update ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'app/controllers/cms/content_block_controller.rb', line 47
def update
if update_block
after_update_on_success
else
after_update_on_failure
end
rescue ActiveRecord::StaleObjectError => @exception
after_update_on_edit_conflict
rescue Exception => @exception
raise @exception if @exception.is_a?(Cms::Errors::AccessDenied)
after_update_on_error
end
|
#usages ⇒ Object
96
97
98
99
100
|
# File 'app/controllers/cms/content_block_controller.rb', line 96
def usages
load_block_draft
@pages = @block.connected_pages.all(:order => 'name')
render "#{template_directory}/usages"
end
|
#version ⇒ Object
79
80
81
82
83
84
85
|
# File 'app/controllers/cms/content_block_controller.rb', line 79
def version
load_block
if params[:version]
@block = @block.as_of_version(params[:version])
end
render "#{template_directory}/show"
end
|
#versions ⇒ Object
87
88
89
90
91
92
93
94
|
# File 'app/controllers/cms/content_block_controller.rb', line 87
def versions
if model_class.versioned?
load_block
render "#{template_directory}/versions"
else
render :text => "Not Implemented", :status => :not_implemented
end
end
|