Module: LoansHelper

Defined in:
app/helpers/loans_helper.rb

Instance Method Summary (collapse)

Instance Method Details



8
9
10
11
# File 'app/helpers/loans_helper.rb', line 8

def loan_link(loan)
  return nil if loan.nil?
  link_to(loan_tag(loan).html_safe, loan)
end

- (Object) loan_tag(loan)



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

def loan_tag(loan)
  return nil if loan.nil?
  [loan.id, loan.people.collect{|a| a.name}.join(', '), loan.recipient_address].delete_if{|b| b.blank? }.join(" - ").gsub(/\n/, '; ') 
end

- (Object) loans_search_form



13
14
15
# File 'app/helpers/loans_helper.rb', line 13

def loans_search_form
  render('/loans/quick_search_form')
end

- (Object) on_loan_tag(object)



17
18
19
20
21
22
# File 'app/helpers/loans_helper.rb', line 17

def on_loan_tag(object)
  if object.is_loanable? && object.on_loan?
    (:h3, 'Loan status') + 
      (:p, ('On ' + link_to('loan', object.loan) + '. Due back on ' + object.loan_return_date.to_s + '.').html_safe)
  end
end