Module: StockitHelper

Defined in:
app/helpers/stockit_helper.rb

Instance Method Summary collapse

Instance Method Details


8
9
10
11
12
13
14
15
16
# File 'app/helpers/stockit_helper.rb', line 8

def link_to_stock_change_reason(stock_change)
  if stock_change.delivery_id
    link_to Delivery.model_name.human, supplier_delivery_path(stock_change.delivery.supplier, stock_change.delivery)
  elsif stock_change.order_id
    link_to Order.model_name.human, order_path(stock_change.order)
  elsif stock_change.stock_taking_id
    link_to StockTaking.model_name.human, stock_taking_path(stock_change.stock_taking)
  end
end

#stock_article_classes(article) ⇒ Object


2
3
4
5
6
# File 'app/helpers/stockit_helper.rb', line 2

def stock_article_classes(article)
  class_names = []
  class_names << "unavailable" if article.quantity_available <= 0
  class_names.join(" ")
end

#stock_article_price_hint(stock_article) ⇒ Object


18
19
20
21
22
23
24
25
# File 'app/helpers/stockit_helper.rb', line 18

def stock_article_price_hint(stock_article)
  t('simple_form.hints.stock_article.edit_stock_article.price',
    :stock_article_copy_link => link_to(t('stockit.form.copy_stock_article'),
      stock_article_copy_path(stock_article),
      :remote => true
    )
  )
end