mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-08 18:28:50 +01:00
Allow changing the ordering of the user list
This commit is contained in:
parent
08791e0457
commit
c4d7169cb8
4 changed files with 19 additions and 13 deletions
|
|
@ -7,16 +7,20 @@ class UsersController < ApplicationController
|
|||
# GET /users GET /users.xml
|
||||
def index
|
||||
respond_to do |format|
|
||||
order_by = 'login'
|
||||
if params[:order] && User.column_names.include?(params[:order])
|
||||
order_by = params[:order]
|
||||
end
|
||||
format.html do
|
||||
@page_title = "TRACKS::Manage Users"
|
||||
@users = User.order('login ASC').paginate :page => params[:page]
|
||||
@page_title = t('users.manage_users_title')
|
||||
@users = User.order(order_by + ' ASC').paginate :page => params[:page]
|
||||
@total_users = User.count
|
||||
# When we call users/signup from the admin page we store the URL so that
|
||||
# we get returned here when signup is successful
|
||||
store_location
|
||||
end
|
||||
format.xml do
|
||||
@users = User.order('login')
|
||||
@users = User.order(order_by)
|
||||
render :xml => @users.to_xml(:root => :users, :except => [:password])
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue