[refs #818] refactoring part 3
This commit is contained in:
parent
1427f86b4c
commit
ba026c948d
|
@ -76,7 +76,7 @@ class Admin::UsersController < Admin::BaseController
|
|||
@users = @users.send(@filter) if ['real', 'admin', 'banned', 'tester'].include? @filter
|
||||
@users = @users.order(order)
|
||||
|
||||
render :partial => "#{action_name == 'system_list' ? 'system_' : ''}users_ajax", :layout => false
|
||||
render :partial => 'users_ajax', :layout => false
|
||||
end
|
||||
|
||||
def system_list
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
users = @users.map do |user|
|
||||
link_block = [
|
||||
(link_to t('layout.users.reset_token'), reset_auth_token_admin_user_path(user), :method => :put, :confirm => t('layout.users.confirm_reset_token') if can? :edit, user),
|
||||
(link_to t('layout.delete'), admin_user_path(user), :method => :delete, :confirm => t('layout.users.confirm_delete') if can? :destroy, user)
|
||||
].compact.join(' | ').html_safe
|
||||
|
||||
[
|
||||
user.uname,
|
||||
link_block
|
||||
]
|
||||
end
|
||||
|
||||
|
||||
json.sEcho params[:sEcho].to_i || -1
|
||||
json.iTotalRecords @total_users
|
||||
json.iTotalDisplayRecords @users.count
|
||||
json.aaData users
|
|
@ -1,10 +1,12 @@
|
|||
users = @users.map do |user|
|
||||
link_block = [
|
||||
(link_to t('layout.show'), user if can? :read, user),
|
||||
(link_to t('layout.edit'), edit_admin_user_path(user) if can? :edit, user),
|
||||
(link_to t('layout.show'), user if can?(:read, user) && action_name == 'list'),
|
||||
(link_to t('layout.edit'), edit_admin_user_path(user) if can?(:edit, user) && action_name == 'list'),
|
||||
(link_to t('layout.users.reset_token'), reset_auth_token_admin_user_path(user), :method => :put, :confirm => t('layout.users.confirm_reset_token') if can?(:edit, user) && action_name == 'system_list'),
|
||||
(link_to t('layout.delete'), admin_user_path(user), :method => :delete, :confirm => t('layout.users.confirm_delete') if can? :destroy, user)
|
||||
].compact.join(' | ').html_safe
|
||||
|
||||
if action_name == 'list'
|
||||
[
|
||||
user.name,
|
||||
user.uname,
|
||||
|
@ -12,6 +14,12 @@ users = @users.map do |user|
|
|||
content_tag(:span, user.role, :style => user.access_locked? ? 'background: #FEDEDE' : ''),
|
||||
link_block
|
||||
]
|
||||
else
|
||||
[
|
||||
user.uname,
|
||||
link_block
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue