Module: LoanItemsHelper

Defined in:
app/helpers/loan_items_helper.rb

Instance Method Summary (collapse)

Instance Method Details



14
15
16
17
# File 'app/helpers/loan_items_helper.rb', line 14

def loan_item_link(loan_item)
  return nil if loan_item.nil?
  link_to(loan_item_tag(loan_item), loan_item) # metamorphosize_if(loan_item.loan_item_object))
end

- (Object) loan_item_tag(loan_item)



3
4
5
6
7
8
9
10
11
12
# File 'app/helpers/loan_items_helper.rb', line 3

def loan_item_tag(loan_item)
  return nil if loan_item.nil?
  [
    object_tag(loan_item.loan_item_object), 
    "[#{loan_item_total_string(loan_item)} total]", 
    (loan_item.returned? ? "returned #{loan_item.date_returned}" : nil), 
    (loan_item.disposition.blank? ? nil : (:span, loan_item.disposition, class: :warning)),
    "(#{loan_item.loan_item_object_type})" 
  ].compact.join(" ").html_safe
end

- (Object) loan_item_total_string(loan_item)



23
24
25
26
27
28
29
# File 'app/helpers/loan_items_helper.rb', line 23

def loan_item_total_string(loan_item)
  if t = loan_item.total_items
    t
  else
    'undefined' 
  end
end

- (Object) loan_items_search_form



19
20
21
# File 'app/helpers/loan_items_helper.rb', line 19

def loan_items_search_form
  render('/loan_items/quick_search_form')
end