2012-07-26 21:25:44 +01:00
|
|
|
users = @users.map do |user|
|
|
|
|
link_block = [
|
2013-01-11 10:03:24 +00:00
|
|
|
(link_to t('layout.edit'), edit_admin_user_path(user) if can?(:edit, user) && !@system_list),
|
2014-03-14 21:55:28 +00:00
|
|
|
(link_to t('layout.users.reset_token'), reset_auth_token_admin_user_path(user), method: :put, data: { confirm: t('layout.users.confirm_reset_token') } if can?(:edit, user) && @system_list),
|
|
|
|
(link_to t('layout.delete'), admin_user_path(user), method: :delete, data: { confirm: t('layout.users.confirm_delete') } if can? :destroy, user)
|
2012-07-26 21:25:44 +01:00
|
|
|
].compact.join(' | ').html_safe
|
|
|
|
|
2013-01-11 10:03:24 +00:00
|
|
|
if !@system_list
|
2013-01-10 16:43:36 +00:00
|
|
|
[
|
|
|
|
user.name,
|
2013-05-29 11:43:40 +01:00
|
|
|
(can?(:read, user) ? link_to(user.uname, user) : user.uname),
|
2013-01-10 16:43:36 +00:00
|
|
|
user.email,
|
2013-05-29 11:43:40 +01:00
|
|
|
user.created_at.to_date,
|
2014-01-21 04:51:49 +00:00
|
|
|
content_tag(:span, user.role, style: user.access_locked? ? 'background: #FEDEDE' : ''),
|
2013-01-10 16:43:36 +00:00
|
|
|
link_block
|
|
|
|
]
|
|
|
|
else
|
|
|
|
[
|
|
|
|
user.uname,
|
|
|
|
link_block
|
|
|
|
]
|
|
|
|
end
|
2012-07-26 21:25:44 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
json.sEcho params[:sEcho].to_i || -1
|
|
|
|
json.iTotalRecords @total_users
|
2012-07-27 13:40:13 +01:00
|
|
|
json.iTotalDisplayRecords @users.count
|
2012-07-26 21:25:44 +01:00
|
|
|
json.aaData users
|