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.12.5 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.12.4 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.12.3 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.12.2 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.12.1 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.12.0 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.11.3 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.11.2 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.11.1 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.11.0 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.10.3 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.10.2 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.10.1 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.10.0 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.5.14 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.5.13 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.5.11 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.5.10 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.5.9 app/controllers/pulitzer/free_form_section_types_controller.rb
pulitzer-0.5.8 app/controllers/pulitzer/free_form_section_types_controller.rb