Class: Admin::ContentBlocksController
Constant Summary
AdminPagination::DEFAULT_MAX_PER_PAGE, AdminPagination::DEFAULT_MIN_PER_PAGE
Instance Method Summary
collapse
#turbo_frame_id, #turbo_frame_request?, #turbo_redirect_to, #turbo_render_form, #turbo_render_index, #turbo_stream_replace_table, #turbo_stream_request?, #turbo_stream_update_table
#paginate_collection, #set_pagination_vars
Instance Method Details
#create ⇒ Object
42
43
44
45
46
47
|
# File 'lib/generators/ruby_cms/templates/controllers/admin/content_blocks_controller.rb', line 42
def create
@content_block = ::ContentBlock.new(content_block_params)
@content_block.record_update_by(current_user_cms)
@content_block.published = true if @content_block.published.nil?
save_and_respond(@content_block, :new)
end
|
#destroy ⇒ Object
53
54
55
56
57
58
|
# File 'lib/generators/ruby_cms/templates/controllers/admin/content_blocks_controller.rb', line 53
def destroy
key = @content_block.key
@content_block.destroy
audit!(:content_block_deleted, target: "ContentBlock:#{key}", summary: "Deleted content block #{key}", meta: { key: })
redirect_with_notice("deleted")
end
|
#edit ⇒ Object
37
38
39
40
|
# File 'lib/generators/ruby_cms/templates/controllers/admin/content_blocks_controller.rb', line 37
def edit
@blocks_by_locale = load_blocks_by_locale_for_edit
render :show
end
|
#index ⇒ Object
14
15
16
17
18
19
20
21
22
|
# File 'lib/generators/ruby_cms/templates/controllers/admin/content_blocks_controller.rb', line 14
def index
collection = content_blocks_collection
@content_blocks = html_index_blocks(collection)
respond_to do |format|
format.html { render_index_html }
format.json { render json: json_index_blocks(collection) }
end
end
|
#new ⇒ Object
29
30
31
32
33
34
35
|
# File 'lib/generators/ruby_cms/templates/controllers/admin/content_blocks_controller.rb', line 29
def new
@content_block = ::ContentBlock.new(new_block_params)
@content_block.published = true if @content_block.published.nil?
end
|
#show ⇒ Object
24
25
26
27
|
# File 'lib/generators/ruby_cms/templates/controllers/admin/content_blocks_controller.rb', line 24
def show
@blocks_by_locale = load_blocks_by_locale_for_edit
respond_with_block(@content_block)
end
|
#update ⇒ Object
49
50
51
|
# File 'lib/generators/ruby_cms/templates/controllers/admin/content_blocks_controller.rb', line 49
def update
unified_locale_params? ? update_all_locales : update_single_block
end
|