Sha256: c3cad36b7d9763be38e979f912f663f72b9ea33ffc75955e0aa59ecea4624fde

Contents?: true

Size: 1.22 KB

Versions: 45

Compression:

Stored size: 1.22 KB

Contents

class Pulitzer::FreeFormSectionTypesController < Pulitzer::ApplicationController
  before_filter :get_ffst, only: [:show, :edit, :update, :destroy]

  def new
    @post_type = Pulitzer::PostType.find(params[:post_type_id])
    @ffst = @post_type.free_form_section_types.build
    render partial: 'new', locals: {ffst: @ffst}
  end

  def create
    @post_type = Pulitzer::PostType.find(ffst_params[:post_type_id])
    @ffst = @post_type.free_form_section_types.create(ffst_params)
    Pulitzer::CreatePostTypeFreeFormSections.new(@ffst).call
    render partial: 'show_wrapper', locals: {ffst: @ffst}
  end

  def show
    render partial: 'show', locals: {ffst: @ffst}
  end

  def edit
    render partial: 'form', locals: {ffst: @ffst}
  end

  def update
    old_label = @ffst.name
    @ffst.update_attributes(ffst_params)
    Pulitzer::UpdatePostTypeFreeFormSections.new(@ffst, old_label).call
    render partial: 'show', locals: {ffst: @ffst}
  end

  def destroy
    @ffst.destroy
    Pulitzer::DestroyPostTypeFreeFormSections.new(@ffst).call
    render nothing: true
  end

  protected

  def get_ffst
    @ffst = Pulitzer::FreeFormSectionType.find(params[:id])
  end

  def ffst_params
    params[:free_form_section_type].permit!
  end

end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
pulitzer-0.5.7 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.5.6 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.5.5 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.5.4 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.5.3 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.5.2 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.5.1 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.5.0 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.4.16 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.4.15 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.4.14 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.4.13 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.4.12 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.4.11 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.4.10 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.4.9 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.4.8 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.4.7 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.4.6 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.4.5 app/controllers/pulitzer/free_form_section_types_controller.rb