Orbit/app/controllers/admin/member_selects_controller.rb

72 lines
1.7 KiB
Ruby
Raw Normal View History

class Admin::MemberSelectsController < OrbitBackendController
2012-11-26 02:14:43 +00:00
def index
# @member_selects = OrbitApp::Module::Role.all
@member_selects = Role.excludes('disabled' => true)
if(!params[:show_plugin_profile].nil?)
@right_partial = OrbitApp::Plugin::Registration.find_by_key(params[:show_plugin_profile]).profile_partial_path rescue 'plugin_summary'
else
@right_partial = "admin/users_new_interface/plugin_summary"
end
@member_select_results = Role.excludes('disabled' => true)
@member_select_search_url = admin_member_selects_path
# @aa = User.where(:role_ids.in => [ "4f45f3b9e9d02c5db900001c"])
end
# def show
# @aa = admin_member_selects_path
# respond_to do |format|
# format.js{ render 'member_select_search' }
# end
# end
def member_select_add
# @users = User.where(:ids.in => [params[:users].collect{|x| x[0]}])
@users = params[:users].collect{|key,value| User.find key } rescue []
# debugger
respond_to do |format|
format.js
end
end
def member_select_search
@pdatas = params[:member_selects]
@users = Role.excludes('disabled' => true)
# debugger
# User.where(:role_ids.in => [ "4f45f3b9e9d02c5db900001c"])
# @users = User.where(:role_ids.in => [ "your role_id"])
# @users.where(:sub_role_ids.in => [id, id, id])
# @member_select_results = Role.excludes('disabled' => true)
2012-12-19 10:51:17 +00:00
@member_select_results = User.not_guest_user.where(:sub_role_ids.in => params[:member_selects][:sub_role])
2012-11-26 02:14:43 +00:00
@member_select_search_url = admin_member_select_member_select_add_path('member_select_add')
respond_to do |format|
format.js
end
end
end