2012-09-22 22:39:12 -04:00
|
|
|
module UsersHelper
|
2014-01-28 22:46:58 -05:00
|
|
|
|
|
|
|
## this one is for building our custom JSON autocomplete format for typeahead
|
|
|
|
def autocomplete_user_array_json(users)
|
|
|
|
temp = []
|
|
|
|
users.each do |u|
|
|
|
|
user = {}
|
|
|
|
user['id'] = u.id
|
|
|
|
user['label'] = u.name
|
2014-02-04 22:03:24 -05:00
|
|
|
user['value'] = u.name
|
2014-11-04 12:37:17 -05:00
|
|
|
user['profile'] = u.image.url(:square)
|
2014-01-28 22:46:58 -05:00
|
|
|
user['mapCount'] = u.maps.count
|
2014-10-01 18:07:05 -04:00
|
|
|
user['created_at'] = u.created_at.strftime("%m/%d/%Y")
|
2014-02-02 14:56:07 -05:00
|
|
|
user['rtype'] = "mapper"
|
2014-01-28 22:46:58 -05:00
|
|
|
|
|
|
|
temp.push user
|
|
|
|
end
|
|
|
|
return temp
|
|
|
|
end
|
|
|
|
|
2012-09-22 22:39:12 -04:00
|
|
|
end
|