Built-in user_attribute_models

This commit is contained in:
chris2tof committed 2011-05-02 12:07:31 +08:00
1 parent 509c106b3e
commit 83bbd77d96
14 files changed
+78 -20

No files matched your search

@@ -34,8 +34,10 @@ class Admin::UserInfoModelsController < ApplicationController
def update
@user_attribute_model = UserInfoModel.find(params[:id])
@user_attribute_model.update_attributes(params[:user_info_model])
redirect_to :action => :index
respond_to do |format|
format.html { redirect_to :action => :index }
format.js { render 'admin/user_attribute_models/toggle_enable' }
end
end
def destroy
@@ -35,7 +35,10 @@ class Admin::UserRoleModelsController < ApplicationController
@user_attribute_model = UserRoleModel.find(params[:id])
@user_attribute_model.update_attributes(params[:user_role_model])
redirect_to :action => :index
respond_to do |format|
format.html { redirect_to :action => :index }
format.js { render 'admin/user_attribute_models/toggle_enable' }
end
end
def destroy
+11 -7
View File
@@ -9,13 +9,12 @@ class Panel::UsersController < ApplicationController
def show
@user = User.find(params[:id])
@user_info_models = UserInfoModel.all.entries
get_info_role_models
end
def new
@user = User.new
@user_info_models = UserInfoModel.all.entries
@user_role_models = UserRoleModel.all.entries
get_info_role_models
end
def create
@@ -38,8 +37,7 @@ class Panel::UsersController < ApplicationController
def edit
@user = User.find(params[:id])
@user_info_models = UserInfoModel.all.entries
@user_role_models = UserRoleModel.all.entries
get_info_role_models
end
def update
@@ -56,8 +54,7 @@ class Panel::UsersController < ApplicationController
flash[:notice] = t('panel.update_success_user')
redirect_to :action => :index
else
@user_info_models = UserInfoModel.all.entries
@user_role_models = UserRoleModel.all.entries
get_info_role_models
render :action => :edit
end
end
@@ -73,4 +70,11 @@ class Panel::UsersController < ApplicationController
redirect_to :action => :index
end
protected
def get_info_role_models
@user_info_models = UserInfoModel.excludes('disabled' => true)
@user_role_models = UserRoleModel.excludes('disabled' => true)
end
end