Sha256: bbf5059b98a0eb6680614285ee2b266fe34cd185689c7fd30fbb53e24b0c138e

Contents?: true

Size: 996 Bytes

Versions: 6

Compression:

Stored size: 996 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/new"
  end

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

  def create
    @content_block = @page.images.build(content_block_params)
    @content_block.update_attributes(src: params[:file])
    render "redditor/admin/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/wrapper"
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
redditor-0.1.17 app/controllers/redditor/admin/image_blocks_controller.rb
redditor-0.1.16 app/controllers/redditor/admin/image_blocks_controller.rb
redditor-0.1.15 app/controllers/redditor/admin/image_blocks_controller.rb
redditor-0.1.14 app/controllers/redditor/admin/image_blocks_controller.rb
redditor-0.1.12 app/controllers/redditor/admin/image_blocks_controller.rb
redditor-0.1.11 app/controllers/redditor/admin/image_blocks_controller.rb