Sha256: 757817452bcd8c36f12d897cbb003d119fed44cdf461892bcf0600e17a3fc976
Contents?: true
Size: 1.86 KB
Versions: 2
Compression:
Stored size: 1.86 KB
Contents
class Admin::UsersController < Admin::ApplicationController layout false belongs_to_spud_app :users add_breadcrumb "Users", :admin_users_path before_filter :load_user, :only => [:edit, :update, :show, :destroy] respond_to :html def index @users = SpudUser.order('login asc') if params[:search] @users = @users.where_name_like(params[:search]) end @users = @users.paginate(:page => params[:page]) respond_with @users do |format| format.html{ if request.xhr? render :partial => 'index' else render 'index', :layout => 'admin/detail' end } end end def show respond_with @user end def new @user = SpudUser.new respond_with @user end def create @user = SpudUser.new(user_params) if @user.save render 'show', :status => 200 else render 'new', :status => 422 end end def edit respond_with @user end def update @user.update_attributes(user_params) respond_with @user, :location => admin_user_path(@user), :status => 200 end def destroy @user.destroy respond_with @user, :location => admin_users_path end private def load_user @user = SpudUser.where(:id => params[:id]).first if @user.blank? flash[:error] = "User not found!" redirect_to admin_users_path and return false end return true end # attr_accessible :login,:email,:first_name,:last_name,:password,:password_confirmation,:password_salt,:last_login_at,:last_request_at,:last_login_ip,:failed_login_count,:current_login_at,:login_count,:persistence_token,:perishable_token,:single_access_token,:crypted_password, :current_login_ip, :created_at, :updated_at,:time_zone, :as => [:default, :admin] # attr_accessible :super_admin, :spud_role_id, :id, :as => :admin def user_params params.require(:spud_user).permit! end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tb_core-1.2.1 | app/controllers/admin/users_controller.rb |
tb_core-1.2.0 | app/controllers/admin/users_controller.rb |