Sha256: d0cc5f1534f382eaa4115ae3c14e1a33ddf24dd0c8d78aa185de42f1ebc2cf1a
Contents?: true
Size: 1.65 KB
Versions: 2
Compression:
Stored size: 1.65 KB
Contents
class Admin::UsersController < ApplicationController helper :rules_engine layout 'rules_engine' # before_filter :login_required before_filter :admin_access_required before_filter :only => [:show, :edit, :update, :destroy] do |controller| controller.re_load_model :user, {:param_id => :id, :redirect_path => :admin_users_path} end def index klass = User if params[:query_type] == 'email' klass = klass.by_ge_email(params[:query]) unless params[:query].blank? klass = klass.order_email elsif params[:query_type] == 'login' klass = klass.by_ge_login(params[:query]) unless params[:query].blank? klass = klass.order_login elsif params[:query_type] == 'full_name' klass = klass.by_ge_full_name(params[:query]) unless params[:query].blank? klass = klass.order_full_name else klass = klass.order_full_name end @users = klass.paginate(:page => params[:page], :per_page => 20) end def show end def new @user = User.new(:time_zone => 'Eastern Time (US & Canada)', :access_level => User::ACCESS_LEVEL_DISABLED) end def create @user = User.new(params[:user]) if @user.save flash[:success] = "Welcome email sent to new user" redirect_to(admin_user_path(@user)) else render :action => "new" end end def edit end def update if @user.update_attributes(params[:user]) flash[:success] = 'User Updated' redirect_to(admin_user_path(@user)) else render :action => "edit" end end def destroy @user.destroy flash[:success] = 'User Deleted' redirect_to(admin_users_path) end end
Version data entries
2 entries across 2 versions & 1 rubygems