Sha256: 1fcb205008b6f9003e4d988b01b84b4ce8754c3c2922f4bc8d405e1458941c20

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

class Admin::BlockLayoutsController < Admin::ForestController
  before_action :set_block_layout, only: [:edit, :update]

  def index
    @block_layouts = apply_scopes(BlockLayout).by_id.page params[:page]
  end

  def new
    @block_layout = BlockLayout.new
    authorize @block_layout
  end

  def edit
    authorize @block_layout
  end

  def create
    @block_layout = BlockLayout.new(block_layout_params)
    authorize @block_layout

    if @block_layout.save
      redirect_to edit_admin_block_layout_path(@block_layout), notice: 'BlockLayout was successfully created.'
    else
      render :new
    end
  end

  def update
    authorize @block_layout

    if @block_layout.update(block_layout_params)
      redirect_to edit_admin_block_layout_path(@block_layout), notice: 'BlockLayout was successfully updated.'
    else
      render :edit
    end
  end

  private

    def block_layout_params
      params.require(:block_layout).permit(:slug, :display_name, :description)
    end

    def set_block_layout
      @block_layout = BlockLayout.find(params[:id])
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
forest_cms-0.98.1 app/controllers/admin/block_layouts_controller.rb