diff --git a/app/models/user.rb b/app/models/user.rb --- a/app/models/user.rb +++ b/app/models/user.rb @@ -12,13 +12,13 @@ has_many :groups_users, class_name: GroupUser has_many :groups, :through => :groups_users - has_many :test_requests, -> {order(submitted_at: DESC)} + has_many :test_requests, -> {order(submitted_at: :desc)} - has_many :messages, -> { order(created_at: DESC) }, + has_many :messages, -> { order(created_at: :desc) }, :class_name => "Message", :foreign_key => "sender_id" - has_many :replied_messages, -> { order(created_at: DESC) }, + has_many :replied_messages, -> { order(created_at: :desc) }, :class_name => "Message", :foreign_key => "receiver_id" diff --git a/app/views/user_admin/index.html.haml b/app/views/user_admin/index.html.haml --- a/app/views/user_admin/index.html.haml +++ b/app/views/user_admin/index.html.haml @@ -41,7 +41,7 @@ %p = link_to '+ New user', { :action => 'new' }, { class: 'btn btn-success '} = link_to '+ New list of users', { :action => 'new_list' }, { class: 'btn btn-success '} - = link_to 'Bulk Manage', bulk_manage_user_admin_path , { class: 'btn btn-default btn-info'} + = link_to 'Bulk Manage', { action: :bulk_manage} , { class: 'btn btn-default btn-info'} = link_to 'View administrators',{ :action => 'admin'}, { class: 'btn btn-default '} = link_to 'Random passwords',{ :action => 'random_all_passwords'}, { class: 'btn btn-default '} = link_to 'View active users',{ :action => 'active'}, { class: 'btn btn-default '} @@ -95,7 +95,7 @@ %td= link_to 'Clear IP', {:action => 'clear_last_ip', :id => user, :page=>params[:page]}, :confirm => 'This will reset last logging in ip of the user, are you sure?', class: 'btn btn-default btn-xs btn-block' %td= link_to 'Show', {:action => 'show', :id => user}, class: 'btn btn-default btn-xs btn-block' %td= link_to 'Edit', {:action => 'edit', :id => user}, class: 'btn btn-default btn-xs btn-block' - %td= link_to 'Destroy', user_admin_destroy_path(user), data: {confirm: 'Are you sure?'}, method: :delete, class: 'btn btn-danger btn-xs btn-block' + %td= link_to 'Destroy', {action: :destroy, id: user}, data: {confirm: 'Are you sure?'}, method: :delete, class: 'btn btn-danger btn-xs btn-block' %br/ = link_to '+ New user', { :action => 'new' }, { class: 'btn btn-success '} = link_to '+ New list of users', { :action => 'new_list' }, { class: 'btn btn-success '} diff --git a/config/routes.rb b/config/routes.rb --- a/config/routes.rb +++ b/config/routes.rb @@ -91,9 +91,17 @@ #user admin resources :user_admin do collection do - get 'bulk_manage', as: 'bulk_manage_user_admin' - delete ':id', to: 'user_admin#destroy', as: 'user_admin_destroy' + get 'bulk_manage' get 'user_stat' + get 'import' + get 'new_list' + get 'admin' + get 'random_all_passwords' + get 'active' + get 'mass_mailing' + end + member do + get 'clear_last_ip' end end