OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/app/cells/members/table_cell.rb

32 lines
785 B

module Members
class TableCell < ::TableCell
options :authorize_update, :available_roles
columns :lastname, :firstname, :mail, :roles, :groups, :status
sortable_columns :lastname, :firstname, :mail
def initial_sort
[:lastname, :desc]
end
def headers
columns.map do |name|
[name.to_s, header_options(name)]
end
end
def header_options(name)
{ caption: User.human_attribute_name(name) }
end
##
# Adjusts the order so that users are joined to support
# sorting by their attributes
def sort_collection(query, sort_clause, sort_columns)
super(join_users(query), sort_clause, sort_columns)
end
def join_users(query)
query.joins(:principal).references(:principal)
end
end
end