Class: Pulitzer::FreeFormSectionTypesController

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

Instance Method Summary collapse

Instance Method Details

#createObject



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

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

#destroyObject



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

def destroy
  @ffst.destroy
  Pulitzer::DestroyPostTypeFreeFormSections.new(@ffst).call
  render nothing: true
end

#editObject



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

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

#newObject



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

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

#showObject



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

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

#updateObject



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

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