rosa-build/app/controllers/users_controller.rb

56 lines
1.2 KiB
Ruby
Raw Normal View History

2011-03-10 11:35:46 +00:00
class UsersController < ApplicationController
before_filter :find_user, :only => [:show, :edit, :update, :destroy]
2011-03-10 21:48:15 +00:00
def index
@users = User.all
end
def show
2011-10-17 15:23:51 +01:00
puts params.inspect
2011-10-16 21:48:31 +01:00
@groups = @user.groups.uniq
@platforms = @user.platforms.paginate(:page => params[:platform_page], :per_page => 10)
@repositories = @user.repositories.paginate(:page => params[:repository_page], :per_page => 10)
@projects = @user.projects.paginate(:page => params[:project_page], :per_page => 10)
end
2011-03-10 21:48:15 +00:00
def new
@user = User.new
end
def edit
end
def destroy
@user.destroy
2011-03-31 03:00:21 +01:00
flash[:notice] = t("flash.user.destroyed")
2011-03-10 21:48:15 +00:00
redirect_to users_path
end
def create
@user = User.new params[:user]
if @user.save
flash[:notice] = t('flash.user.saved')
redirect_to users_path
else
flash[:error] = t('flash.user.save_error')
render :action => :new
end
end
def update
if @user.update_attributes(params[:user])
flash[:notice] = t('flash.user.saved')
redirect_to users_path
else
flash[:error] = t('flash.user.save_error')
render :action => :edit
end
end
protected
def find_user
@user = User.find(params[:id])
end
2011-03-10 11:35:46 +00:00
end