74 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Ruby
		
	
	
	
		
		
			
		
	
	
			74 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Ruby
		
	
	
	
| 
								 | 
							
								class Admin::MemberSelectsController < ApplicationController
							 | 
						||
| 
								 | 
							
								  
							 | 
						||
| 
								 | 
							
								  layout "new_admin"
							 | 
						||
| 
								 | 
							
								  
							 | 
						||
| 
								 | 
							
								  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)
							 | 
						||
| 
								 | 
							
								    @member_select_results = User.where(:sub_role_ids.in => params[:member_selects][:sub_role])
							 | 
						||
| 
								 | 
							
									
							 | 
						||
| 
								 | 
							
									@member_select_search_url = admin_member_select_member_select_add_path('member_select_add')
							 | 
						||
| 
								 | 
							
									
							 | 
						||
| 
								 | 
							
									
							 | 
						||
| 
								 | 
							
								    respond_to do |format|
							 | 
						||
| 
								 | 
							
								      format.js
							 | 
						||
| 
								 | 
							
								    end
							 | 
						||
| 
								 | 
							
									
							 | 
						||
| 
								 | 
							
								  end
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								end
							 |