member roles edit
This commit is contained in:
		
							parent
							
								
									87a89f81ce
								
							
						
					
					
						commit
						18a51f070e
					
				| 
						 | 
					@ -1,14 +1,14 @@
 | 
				
			||||||
function checkSwitch() {
 | 
					function checkSwitch() {
 | 
				
			||||||
    $(".groups").each(function() {
 | 
					    // $(".groups").each(function() {
 | 
				
			||||||
        $(this).find('.form-horizontal > .hide').length < $(this).find('.form-horizontal > div').length ? $(this).removeClass("disabled") : $(this).addClass("disabled")
 | 
					        // $(this).find('.form-horizontal > .hide').length < $(this).find('.form-horizontal > div').length ? $(this).removeClass("disabled") : $(this).addClass("disabled")
 | 
				
			||||||
    });
 | 
					    // });
 | 
				
			||||||
    // $(".groups").addClass('disabled').has('.groups > .form-horizontal > div:not(.hide)').removeClass('disabled');
 | 
					    // $(".groups").addClass('disabled').has('.groups > .form-horizontal > div:not(.hide)').removeClass('disabled');
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$(document).ready(function(){
 | 
					$(document).ready(function(){
 | 
				
			||||||
    checkSwitch();
 | 
					    // checkSwitch();
 | 
				
			||||||
    $('.onoff').click(function () {
 | 
					    $('.onoff').click(function () {
 | 
				
			||||||
        if($(this).parents("h4").length==1) {
 | 
					        if($(this).parent("h4").length==1) {
 | 
				
			||||||
            $(this).parents(".map-block").toggleClass("disabled");
 | 
					            $(this).parents(".map-block").toggleClass("disabled");
 | 
				
			||||||
            $(this).parents(".map-block").find(".form-horizontal").toggleClass("hide");
 | 
					            $(this).parents(".map-block").find(".form-horizontal").toggleClass("hide");
 | 
				
			||||||
            if($(this).parents(".map-block").hasClass("disabled")){
 | 
					            if($(this).parents(".map-block").hasClass("disabled")){
 | 
				
			||||||
| 
						 | 
					@ -19,17 +19,17 @@ $(document).ready(function(){
 | 
				
			||||||
                $(this).siblings(".subrole_disable_field").val("false");
 | 
					                $(this).siblings(".subrole_disable_field").val("false");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if($(this).parents("legend").length==1) {
 | 
					        if($(this).parent("legend").length==1) {
 | 
				
			||||||
            $(this).toggleClass("disabled");
 | 
					            $(this).toggleClass("disabled");
 | 
				
			||||||
            $(this).parents("legend").next("div").toggleClass("hide");
 | 
					            $(this).parent("legend").next("div").toggleClass("hide");
 | 
				
			||||||
            if($(this).parents("legend").next("div").hasClass("hide")){
 | 
					            if($(this).parent("legend").next("div").hasClass("hide")){
 | 
				
			||||||
                $(this).text("OFF");
 | 
					                $(this).text("OFF");
 | 
				
			||||||
                $(this).siblings(".subrole_disable_field").val("true");
 | 
					                $(this).siblings(".subrole_disable_field").val("true");
 | 
				
			||||||
            }else{
 | 
					            }else{
 | 
				
			||||||
                $(this).text("ON");
 | 
					                $(this).text("ON");
 | 
				
			||||||
                $(this).siblings(".subrole_disable_field").val("false");
 | 
					                $(this).siblings(".subrole_disable_field").val("false");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            checkSwitch();
 | 
					            // checkSwitch();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
       return false;
 | 
					       return false;
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,7 +11,10 @@ class Admin::InfosController < ApplicationController
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
    @roles = Role.excludes('disabled' => true)
 | 
					    @roles = Role.excludes('disabled' => true)
 | 
				
			||||||
	 
 | 
						 
 | 
				
			||||||
    render :template => 'admin/attributes/index'
 | 
					    # render :template => 'admin/attributes/index'
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						redirect_to(edit_admin_info_path(Info.first.id.to_s))
 | 
				
			||||||
 | 
						
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  def show
 | 
					  def show
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,7 +11,7 @@
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
      <label>
 | 
					      <label>
 | 
				
			||||||
    <%= f.check_box :admin %>
 | 
					    <%= f.check_box :admin %>
 | 
				
			||||||
  <span><%= t(:admin) %>:</span>
 | 
					  <span><%= t("admin") %>:</span>
 | 
				
			||||||
  </label>
 | 
					  </label>
 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in New Issue