Sha256: 4852c2006f543ef305c09008fb59ddd94c33583c64524cb751f2b97d8d70a4af

Contents?: true

Size: 1.28 KB

Versions: 19

Compression:

Stored size: 1.28 KB

Contents

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

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

  def create
    @post_type_version = Pulitzer::PostTypeVersion.find(ffst_params[:post_type_version_id])
    @ffst = @post_type_version.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
    head :ok and return
  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

19 entries across 19 versions & 1 rubygems

Version Path
pulitzer-0.15.31 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.30 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.29 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.28 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.27 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.26 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.25 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.24 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.23 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.22 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.21 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.20 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.19 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.18 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.17 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.16 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.15 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.14 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.13 app/controllers/pulitzer/free_form_section_types_controller.rb