member roles edit

This commit is contained in:
unknown 2013-01-18 10:37:55 +08:00
parent 6a5c1d9007
commit 2e4fb361d7
3 changed files with 14 additions and 11 deletions

View File

@ -1,14 +1,14 @@
function checkSwitch() {
$(".groups").each(function() {
$(this).find('.form-horizontal > .hide').length < $(this).find('.form-horizontal > div').length ? $(this).removeClass("disabled") : $(this).addClass("disabled")
});
// $(".groups").each(function() {
// $(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');
}
$(document).ready(function(){
checkSwitch();
// checkSwitch();
$('.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").find(".form-horizontal").toggleClass("hide");
if($(this).parents(".map-block").hasClass("disabled")){
@ -19,17 +19,17 @@ $(document).ready(function(){
$(this).siblings(".subrole_disable_field").val("false");
}
}
if($(this).parents("legend").length==1) {
if($(this).parent("legend").length==1) {
$(this).toggleClass("disabled");
$(this).parents("legend").next("div").toggleClass("hide");
if($(this).parents("legend").next("div").hasClass("hide")){
$(this).parent("legend").next("div").toggleClass("hide");
if($(this).parent("legend").next("div").hasClass("hide")){
$(this).text("OFF");
$(this).siblings(".subrole_disable_field").val("true");
}else{
$(this).text("ON");
$(this).siblings(".subrole_disable_field").val("false");
}
checkSwitch();
// checkSwitch();
}
return false;
});

View File

@ -11,7 +11,10 @@ class Admin::InfosController < ApplicationController
@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
def show

View File

@ -11,7 +11,7 @@
</div>
<label>
<%= f.check_box :admin %>
<span><%= t(:admin) %></span>
<span><%= t("admin") %></span>
</label>
</div>