Module: BasketsHelper

Included in:
BasketsController
Defined in:
app/helpers/baskets_helper.rb

Instance Method Summary collapse

Instance Method Details



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/helpers/baskets_helper.rb', line 9

def basket_edit_link basket , options = {}
  return "---" unless basket
  return "" unless request.url.include?("basket")
  if basket.locked?
    text =  I18n.t(:locked) + ": "
    case basket.kori
    when Order
      text += I18n.t(:order)
      link = office.order_path(basket.kori)
    when Purchase
      text += I18n.t(:purchase)
      link = office.purchase_path(basket.kori)
    else
      raise "System Error: Locked basket without order #{basket.id}"
    end
  else
    if basket.kori
      key = basket.kori.class.name.downcase
      text = I18n.t(key)
    else
      text = t(:basket)
    end
    link = office.edit_basket_path(basket)
  end
  return link_to text , link , options
end

#has_receipt?Boolean

Returns:

  • (Boolean)


4
5
6
7
8
# File 'app/helpers/baskets_helper.rb', line 4

def has_receipt?
  styles = OfficeClerk.config(:print_styles)
  return false if styles.nil?
  return styles.split.include?("receipt")
end