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.4.4 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.4.3 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.4.2 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.4.1 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.4.0 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.3.9 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.3.8 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.3.7 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.3.6 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.3.5 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.3.4 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.3.3 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.3.2 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.3.1 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.3.0 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.2.2 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.2.1 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.2.0 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.1.10 app/controllers/pulitzer/post_type_content_element_types_controller.rb
pulitzer-0.1.9 app/controllers/pulitzer/post_type_content_element_types_controller.rb