Class: Redditor::Admin::ImageBlocksController
- Inherits:
-
BaseController
- Object
- BaseController
- Redditor::Admin::ImageBlocksController
- Defined in:
- app/controllers/redditor/admin/image_blocks_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
16 17 18 19 20 |
# File 'app/controllers/redditor/admin/image_blocks_controller.rb', line 16 def create @content_block = @page.images.build(content_block_params) @content_block.update_attributes(src: params[:file]) render "redditor/admin/pages/wrapper" end |
#destroy ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'app/controllers/redditor/admin/image_blocks_controller.rb', line 22 def destroy @content_block = @page.images.find(params[:id]) if @content_block.destroy render :js => "$('#image_#{@content_block.id}').closest('dd').remove();" else render :js => "alert('Контент-блок не удален');" end end |
#new ⇒ Object
5 6 7 8 |
# File 'app/controllers/redditor/admin/image_blocks_controller.rb', line 5 def new @content_block = @page.images.build(content_block_params) render "redditor/admin/pages/new" end |
#update ⇒ Object
10 11 12 13 14 |
# File 'app/controllers/redditor/admin/image_blocks_controller.rb', line 10 def update @content_block = @page.images.find(params[:id]) @content_block.update_attributes(content_block_params) render "redditor/admin/pages/wrapper" end |
#update_post ⇒ Object
31 32 33 34 35 |
# File 'app/controllers/redditor/admin/image_blocks_controller.rb', line 31 def update_post @content_block = @page.images.find(params[:id]) @content_block.update_attributes(src: params[:file]) render "redditor/admin/pages/wrapper" end |