Class: RubyCms::Admin::ContentBlocksController
Constant Summary
RubyCms::AdminPagination::DEFAULT_MAX_PER_PAGE, RubyCms::AdminPagination::DEFAULT_MIN_PER_PAGE
Instance Method Summary
collapse
#turbo_frame_id, #turbo_frame_request?, #turbo_redirect_to, #turbo_render_index, #turbo_stream_replace_table, #turbo_stream_request?, #turbo_stream_update_table
#paginate_collection, #set_pagination_vars
Instance Method Details
#create ⇒ Object
43
44
45
46
47
48
|
# File 'app/controllers/ruby_cms/admin/content_blocks_controller.rb', line 43
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
54
55
56
57
|
# File 'app/controllers/ruby_cms/admin/content_blocks_controller.rb', line 54
def destroy
@content_block.destroy
redirect_with_notice("deleted")
end
|
#edit ⇒ Object
38
39
40
41
|
# File 'app/controllers/ruby_cms/admin/content_blocks_controller.rb', line 38
def edit
@blocks_by_locale = load_blocks_by_locale_for_edit
render :show
end
|
#index ⇒ Object
15
16
17
18
19
20
21
22
23
|
# File 'app/controllers/ruby_cms/admin/content_blocks_controller.rb', line 15
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
30
31
32
33
34
35
36
|
# File 'app/controllers/ruby_cms/admin/content_blocks_controller.rb', line 30
def new
@content_block = ::ContentBlock.new(new_block_params)
@content_block.published = true if @content_block.published.nil?
end
|
#show ⇒ Object
25
26
27
28
|
# File 'app/controllers/ruby_cms/admin/content_blocks_controller.rb', line 25
def show
@blocks_by_locale = load_blocks_by_locale_for_edit
respond_with_block(@content_block)
end
|
#update ⇒ Object
50
51
52
|
# File 'app/controllers/ruby_cms/admin/content_blocks_controller.rb', line 50
def update
unified_locale_params? ? update_all_locales : update_single_block
end
|