journalduhacker/app/controllers/users_controller.rb

33 lines
899 B
Ruby
Raw Normal View History

class UsersController < ApplicationController
2012-06-30 21:14:35 +02:00
def show
2014-01-12 21:22:47 +01:00
@showing_user = User.where(:username => params[:username]).first!
@title = "User #{@showing_user.username}"
2012-06-30 21:14:35 +02:00
end
2012-07-08 02:47:13 +02:00
def tree
@title = "Users"
if params[:by].to_s == "karma"
@users = User.order("karma DESC, id ASC").to_a
@user_count = @users.length
@title << " By Karma"
render :action => "list"
elsif params[:moderators]
@users = User.where("is_admin = 1 OR is_moderator = 1").
order("id ASC").to_a
@user_count = @users.length
@title = "Moderators and Administrators"
render :action => "list"
else
users = User.order("id DESC").to_a
@user_count = users.length
@users_by_parent = users.group_by(&:invited_by_user_id)
@newest = User.order("id DESC").limit(10)
end
2012-07-08 02:47:13 +02:00
end
def invite
@title = "Pass Along an Invitation"
end
end