Class: Pulitzer::PostTypeContentElementTypesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/pulitzer/post_type_content_element_types_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



10
11
12
13
14
15
# File 'app/controllers/pulitzer/post_type_content_element_types_controller.rb', line 10

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

#destroyObject



32
33
34
35
36
# File 'app/controllers/pulitzer/post_type_content_element_types_controller.rb', line 32

def destroy
  @ptcet.destroy
  Pulitzer::DestroyPostTypeContentElements.new(@ptcet).call
  head :ok and return
end

#editObject



21
22
23
# File 'app/controllers/pulitzer/post_type_content_element_types_controller.rb', line 21

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

#newObject



4
5
6
7
8
# File 'app/controllers/pulitzer/post_type_content_element_types_controller.rb', line 4

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

#showObject



17
18
19
# File 'app/controllers/pulitzer/post_type_content_element_types_controller.rb', line 17

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

#updateObject



25
26
27
28
29
30
# File 'app/controllers/pulitzer/post_type_content_element_types_controller.rb', line 25

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