Module: UsersHelper

Defined in:
frontend/app/helpers/users_helper.rb

Instance Method Summary collapse

Instance Method Details

#sort_direction(field, params, default) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'frontend/app/helpers/users_helper.rb', line 11

def sort_direction(field, params, default)
  direction = params['direction']
  return 'desc' unless direction

  sort = params['sort']
  return default if sort != field.to_s

  direction == 'asc' ? 'desc' : 'asc'
end

#sort_pointer(field, params, default) ⇒ Object



2
3
4
5
6
7
8
9
# File 'frontend/app/helpers/users_helper.rb', line 2

def sort_pointer(field, params, default)
  direction = params['direction']
  sort = params['sort']
  return default unless direction && sort
  return '' unless sort == field.to_s

  direction == 'asc' ? '▲' : '▼'
end