rosa-build/app/views/admin/_users/_users_ajax.json.jbuilder

30 lines
1.0 KiB
Plaintext
Raw Normal View History

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)
].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,
(can?(:read, user) ? link_to(user.uname, user) : user.uname),
2013-01-10 16:43:36 +00:00
user.email,
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
end
json.sEcho params[:sEcho].to_i || -1
json.iTotalRecords @total_users
json.iTotalDisplayRecords @users.count
json.aaData users