Module: RequestsHelper

Defined in:
app/helpers/requests_helper.rb

Overview

Helpers for requests' views

Instance Method Summary collapse

Instance Method Details

Outputs the link to the reimbursement displayed in the requests list. If there is no reimbursement, it outputs the button for creating it (if possible).

Parameters:

Returns:

  • (String)

    HTML output



13
14
15
16
17
18
19
20
21
# File 'app/helpers/requests_helper.rb', line 13

def reimbursement_link(request)
  if request.reimbursement
    link_to request.reimbursement.label, request_reimbursement_path(request)
  elsif can?(:create, request.build_reimbursement)
    link_to t(:create_reimbursement_short), request_reimbursement_path(request), method: :post, class: 'btn btn-default btn-sm'
  else
    '-'
  end
end