Class: ReviewCpt::Cell::FirstStep

Inherits:
Trailblazer::Cell
  • Object
show all
Defined in:
app/concepts/review_cpt/cell/first_step.rb

Overview

requires review instance and reservation instance when initialize new instance

@example:

render html: cell(ReviewCpt::Cell::FirstStep, review, reservation: reservation), layout: true

Direct Known Subclasses

LandingPage, NewAccount, SecondStep

Instance Method Summary collapse

Instance Method Details

#dining_dateObject



17
18
19
# File 'app/concepts/review_cpt/cell/first_step.rb', line 17

def dining_date
  I18n.l(reservation.date, format: :full_date_but_short_month)
end

#editable?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'app/concepts/review_cpt/cell/first_step.rb', line 37

def editable?
  model.complete == true
end

#encrypted_reservation_idObject



21
22
23
# File 'app/concepts/review_cpt/cell/first_step.rb', line 21

def encrypted_reservation_id
  reservation.encrypted_id
end

#knew_about_disclose_data?Boolean

Returns:

  • (Boolean)


25
26
27
28
29
30
31
32
33
34
35
# File 'app/concepts/review_cpt/cell/first_step.rb', line 25

def knew_about_disclose_data?
  data = if reservation.user_id.present?
           SharedCustomer.find_by(user_id: reservation.user_id, reservation_id: reservation.id)
         else
           SharedCustomer.find_by(reservation_id: reservation.id)
         end

  return true if data.present? && !data.disclose_review.nil?

  false
end

#restaurant_nameObject



13
14
15
# File 'app/concepts/review_cpt/cell/first_step.rb', line 13

def restaurant_name
  reservation.restaurant&.name
end