Sha256: 524ba78b19e0fbbca009243d428228a65b308f515b013c0b8f14521cc61220fc

Contents?: true

Size: 1.28 KB

Versions: 72

Compression:

Stored size: 1.28 KB

Contents

class Pulitzer::PostTypeContentElementTypesController < Pulitzer::ApplicationController
  before_filter :get_ptcet, only: [:show, :edit, :update, :destroy]

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

  def create
    @post_type = Pulitzer::PostType.find(ptcet_params[:post_type_id])
    @ptcet = @post_type.post_type_content_element_types.create(ptcet_params)
    Pulitzer::CreatePostTypeContentElements.new(@ptcet).call
    render partial: 'show_wrapper', locals: {ptcet: @ptcet}
  end

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

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

  def update
    old_label = @ptcet.label
    @ptcet.update_attributes(ptcet_params)
    Pulitzer::UpdatePostTypeContentElements.new(@ptcet, old_label).call
    render partial: 'show', locals: {ptcet: @ptcet}
  end

  def destroy
    @ptcet.destroy
    Pulitzer::DestroyPostTypeContentElements.new(@ptcet).call
    render nothing: true
  end

  protected

  def get_ptcet
    @ptcet = Pulitzer::PostTypeContentElementType.find(params[:id])
  end

  def ptcet_params
    params[:post_type_content_element_type].permit!
  end

end

Version data entries

72 entries across 72 versions & 1 rubygems

Version Path
pulitzer-0.12.5 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.12.4 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.12.3 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.12.2 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.12.1 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.12.0 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.11.3 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.11.2 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.11.1 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.11.0 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.10.3 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.10.2 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.10.1 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.10.0 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.5.14 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.5.13 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.5.11 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.5.10 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.5.9 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.5.8 app/controllers/pulitzer/post_type_content_element_types_controller.rb