Sha256: 0efbba049d63143b517d52f501c126ec688238b0f636fa0e2d37c6197819741f

Contents?: true

Size: 1.27 KB

Versions: 13

Compression:

Stored size: 1.27 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
  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

13 entries across 13 versions & 1 rubygems

Version Path
pulitzer-0.15.12 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.11 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.10 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.9 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.8 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.7 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.6 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.5 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.4 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.3 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.2 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.1 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.15.0 app/controllers/pulitzer/free_form_section_types_controller.rb