Module: Comable::ApplicationHelper

Included in:
OrderMailer
Defined in:
app/helpers/comable/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#current_orderObject

Override the devise method. The below codes move to core/lib/comable/core/engine.rb:

def current_customer

...

end



14
15
16
# File 'app/helpers/comable/application_helper.rb', line 14

def current_order
  current_customer.incomplete_order
end

#current_storeObject



3
4
5
# File 'app/helpers/comable/application_helper.rb', line 3

def current_store
  @current_store ||= Comable::Store.instance
end

#name_with_honorific(name) ⇒ Object



31
32
33
# File 'app/helpers/comable/application_helper.rb', line 31

def name_with_honorific(name)
  Comable.t('honorific', name: name)
end

#name_with_quantity(name, quantity) ⇒ Object



35
36
37
38
39
40
41
42
# File 'app/helpers/comable/application_helper.rb', line 35

def name_with_quantity(name, quantity)
  return name unless quantity
  return name if quantity <= 1
  [
    name,
    "x#{quantity}"
  ].join(' ')
end

#next_order_pathObject



18
19
20
# File 'app/helpers/comable/application_helper.rb', line 18

def next_order_path
  comable.next_order_path(state: current_order.state)
end

#store_locationObject



27
28
29
# File 'app/helpers/comable/application_helper.rb', line 27

def store_location
  session[:customer_return_to] = request.fullpath.gsub('//', '/')
end

#update_order_pathObject



22
23
24
25
# File 'app/helpers/comable/application_helper.rb', line 22

def update_order_path
  return next_order_path unless params[:state]
  comable.next_order_path(state: params[:state])
end