2010-03-04 08:33:26 +00:00
|
|
|
class Panel::UsersController < ApplicationController
|
|
|
|
|
|
|
|
layout "panel"
|
|
|
|
before_filter :authenticate_user!
|
|
|
|
|
|
|
|
def index
|
|
|
|
@users = User.all
|
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
|
|
|
@user = User.find(params[:id])
|
|
|
|
end
|
|
|
|
|
|
|
|
def new
|
|
|
|
@user = User.new
|
2010-03-08 09:14:59 +00:00
|
|
|
@user_attributes = UserAttribute.all
|
2010-03-04 08:33:26 +00:00
|
|
|
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])
|
2010-03-08 09:14:59 +00:00
|
|
|
@user_attributes = UserAttribute.all
|
2010-03-04 08:33:26 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
|
|
@user = User.find(params[:id])
|
|
|
|
if @user.update_attributes(params[:user])
|
|
|
|
redirect_to :action => :index
|
|
|
|
else
|
|
|
|
render :action => :edit
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
@user = User.find(params[:id])
|
|
|
|
@user.destroy
|
|
|
|
|
|
|
|
redirect_to :action => :index
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|