Class: Blocky::ContentBlocksController
Instance Method Summary
collapse
Methods included from Auth
#blocky_current_user, #current_ability, #devise_resource_name, #login_redirect_path, #redirect_back_or_default, #store_location, #unauthorized
Instance Method Details
#edit ⇒ Object
8
9
|
# File 'app/controllers/blocky/content_blocks_controller.rb', line 8
def edit
end
|
#index ⇒ Object
11
12
13
14
15
16
|
# File 'app/controllers/blocky/content_blocks_controller.rb', line 11
def index
@global_content_blocks = Blocky::ContentBlock.global
@content_blocks = Blocky::ContentBlock.per_page
respond_with @content_blocks
end
|
#show ⇒ Object
18
19
20
21
22
23
|
# File 'app/controllers/blocky/content_blocks_controller.rb', line 18
def show
respond_to do |format|
format.html { redirect_to(action: :edit) }
format.json
end
end
|
#update ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'app/controllers/blocky/content_blocks_controller.rb', line 25
def update
if @content_block.update(content_block_params)
respond_to do |format|
format.html {
redirect_to(content_blocks_url, notice: "Content block :#{@content_block.name} was updated successfully.")
}
format.json {
render action: :show
}
end
else
respond_to do |format|
format.html {
render action: :edit
}
format.json {
render json: @content_block.errors, status: :unprocessable_entity
}
end
end
end
|