This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
orbit-4-1/app/controllers/panel/users_controller.rb

58 lines
1.2 KiB
Ruby
Raw Normal View History

class Panel::UsersController < ApplicationController
layout "panel"
before_filter :authenticate_user!
def index
@users = User.all.entries
end
def show
@user = User.find(params[:id])
end
def new
@user = User.new
2011-02-01 02:46:26 +00:00
@user_role_models = UserRoleModel.all.entries
session[:last_page] = get_go_back || panel_users_url
end
def create
@user = User.new(params[:user])
if @user.save
redirect_to :action => :index
else
render :action => :new
end
end
def edit
@user = User.find(params[:id])
2011-02-01 02:46:26 +00:00
@user_role_models = UserRoleModel.all.entries
session[:last_page] = get_go_back || panel_users_url
end
def update
@user = User.find(params[:id])
# Update changes to the avatar
@user.remove_avatar! if params[:file]
@user.avatar = params[:file] if params[:file]
if @user.update_attributes(params[:user])
redirect_to :action => :index
else
2011-02-01 02:46:26 +00:00
@user_role_models = UserRoleModel.all.entries
render :action => :edit
end
end
def destroy
@user = User.find(params[:id])
@user.destroy
redirect_to :action => :index
end
end