Sha256: 594703df6119543ee3bcace3e486c365a183896d81a48cd0a9b9321515844383

Contents?: true

Size: 1009 Bytes

Versions: 2

Compression:

Stored size: 1009 Bytes

Contents

class Manifest::ContentBlocksController < Manifest::ManifestController
  before_filter :authorize
  before_filter :authorize_admin, except: [:index, :edit, :update]

  layout 'manifest/manifest'

  def index
    @content_blocks = ContentBlock.all
  end

  def new
    @content_block = ContentBlock.new
  end

  def create
    @content_block = ContentBlock.new(params[:content_block])

    if @content_block.save
      expire_all_pages
      redirect_to manifest_content_blocks_path
    else
      render 'new'
    end
  end

  def edit
    @content_block = ContentBlock.find(params[:id])
  end

  def update
    @content_block = ContentBlock.find(params[:id])

    if @content_block.update_attributes(params[:content_block])
      expire_all_pages
      redirect_to manifest_content_blocks_path
    else
      render 'edit'
    end
  end

  def destroy
    @content_block = ContentBlock.find(params[:id])
    @content_block.delete

    expire_all_pages

    redirect_to manifest_content_blocks_path
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
manifest-rails-0.0.4 app/controllers/manifest/content_blocks_controller.rb
manifest-rails-0.0.3 app/controllers/manifest/content_blocks_controller.rb