Sha256: d5b9d3109531dda37b637eeebb6ea62c0b18fc166259cea55c52f3341f323f16

Contents?: true

Size: 1020 Bytes

Versions: 11

Compression:

Stored size: 1020 Bytes

Contents

# coding: utf-8

class Redditor::Admin::ImageBlocksController < Redditor::Admin::BaseController

  def new
    @content_block = @page.images.build(content_block_params)
    render "redditor/admin/pages/new"
  end

  def update
    @content_block = @page.images.find(params[:id])
    @content_block.update_attributes(content_block_params)
    render "redditor/admin/pages/wrapper"
  end

  def create
    @content_block = @page.images.build(content_block_params)
    @content_block.update_attributes(src: params[:file])
    render "redditor/admin/pages/wrapper"
  end

  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

  def update_post
    @content_block = @page.images.find(params[:id])
    @content_block.update_attributes(src: params[:file])
    render "redditor/admin/pages/wrapper"
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
redditor-0.1.10 app/controllers/redditor/admin/image_blocks_controller.rb
redditor-0.1.9 app/controllers/redditor/admin/image_blocks_controller.rb
redditor-0.1.8 app/controllers/redditor/admin/image_blocks_controller.rb
redditor-0.1.7 app/controllers/redditor/admin/image_blocks_controller.rb
redditor-0.1.6 app/controllers/redditor/admin/image_blocks_controller.rb
redditor-0.1.5 app/controllers/redditor/admin/image_blocks_controller.rb
redditor-0.1.4 app/controllers/redditor/admin/image_blocks_controller.rb
redditor-0.1.3 app/controllers/redditor/admin/image_blocks_controller.rb
redditor-0.1.2 app/controllers/redditor/admin/image_blocks_controller.rb
redditor-0.1.1 app/controllers/redditor/admin/image_blocks_controller.rb
redditor-0.1.0 app/controllers/redditor/admin/image_blocks_controller.rb