Class: TestimonialsController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

caches_page_with_cache_marker, #raise_not_found!

Instance Method Details

#createObject



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

def create
  @testimonial.remote_ip = request.remote_ip
  @testimonial. = .id
  @testimonial.update_attributes(testimonial_params)

  # create report in crm
  TranslationCms::Api::Report.create_from_params(testimonial_params, ReportType.review)

  respond_with @testimonial, location: testimonials_path
end

#indexObject



13
14
15
16
17
18
19
# File 'app/controllers/testimonials_controller.rb', line 13

def index
  @text = page_text('testimonials-text')
  params[:per] = 10 if params[:per].blank? || params[:per].to_i < 1
  @testimonials = Testimonial.past.visible.local.page(params[:page]).per(params[:per])

  respond_with @testimonials
end

#newObject



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

def new
  @text = page_text('testimonials-text', :footer)
  respond_with(@testimonial)
end

#searchObject



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

def search
  @text = page_text('testimonials-text')
  params[:per] = 10 if params[:per].blank? || params[:per].to_i < 1
  @testimonials = Testimonial.past.visible.local.order_first(params[:id]).page(params[:page]).per(params[:per])

  respond_with @testimonials, template: 'testimonials/index'
end