Class: TestimonialsController

Inherits:
AdminController
  • Object
show all
Defined in:
app/controllers/testimonials_controller.rb

Overview

Handling testimonials

Instance Method Summary collapse

Instance Method Details

#checkObject

post /testimonials/check



8
9
10
11
12
# File 'app/controllers/testimonials_controller.rb', line 8

def check
  @entity = Testimonial.instance_for_check(params[:entity_id], entity_parameters)

  render 'shared/forms/check'
end

#createObject

post /testimonials



20
21
22
23
24
25
26
27
28
# File 'app/controllers/testimonials_controller.rb', line 20

def create
  @entity = Testimonial.new(entity_parameters)
  @entity.language = current_language
  if @entity.save
    form_processed_ok(admin_testimonial_path(id: @entity.id))
  else
    form_processed_with_error(:new)
  end
end

#destroyObject

delete /testimonials/:id



44
45
46
47
48
# File 'app/controllers/testimonials_controller.rb', line 44

def destroy
  flash[:notice] = t('testimonials.destroy.success') if @entity.destroy

  redirect_to(admin_testimonials_path)
end

#editObject

get /testimonials/:id/edit



31
32
# File 'app/controllers/testimonials_controller.rb', line 31

def edit
end

#newObject

get /testimonials/new



15
16
17
# File 'app/controllers/testimonials_controller.rb', line 15

def new
  @entity = Testimonial.new
end

#updateObject

patch /testimonials/:id



35
36
37
38
39
40
41
# File 'app/controllers/testimonials_controller.rb', line 35

def update
  if @entity.update entity_parameters
    form_processed_ok(admin_testimonial_path(id: @entity.id))
  else
    form_processed_with_error(:edit)
  end
end