This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
orbit-4-1/app/assets/Archive/javascripts/inc/attribute_onoff.js

38 lines
1.5 KiB
JavaScript
Raw Normal View History

2012-11-15 09:23:39 +00:00
function checkSwitch() {
2013-01-18 02:37:55 +00:00
// $(".groups").each(function() {
// $(this).find('.form-horizontal > .hide').length < $(this).find('.form-horizontal > div').length ? $(this).removeClass("disabled") : $(this).addClass("disabled")
// });
2012-11-15 09:23:39 +00:00
// $(".groups").addClass('disabled').has('.groups > .form-horizontal > div:not(.hide)').removeClass('disabled');
}
$(document).ready(function(){
2013-01-18 02:37:55 +00:00
// checkSwitch();
2012-11-15 09:23:39 +00:00
$('.onoff').click(function () {
2013-01-18 02:37:55 +00:00
if($(this).parent("h4").length==1) {
2012-11-15 09:23:39 +00:00
$(this).parents(".map-block").toggleClass("disabled");
$(this).parents(".map-block").find(".form-horizontal").toggleClass("hide");
if($(this).parents(".map-block").hasClass("disabled")){
$(this).text("OFF");
$(this).siblings(".subrole_disable_field").val("true");
2012-11-15 09:23:39 +00:00
}else{
$(this).text("ON");
$(this).siblings(".subrole_disable_field").val("false");
2012-11-15 09:23:39 +00:00
}
}
2013-01-18 02:37:55 +00:00
if($(this).parent("legend").length==1) {
2012-11-15 09:23:39 +00:00
$(this).toggleClass("disabled");
2013-01-18 02:37:55 +00:00
$(this).parent("legend").next("div").toggleClass("hide");
if($(this).parent("legend").next("div").hasClass("hide")){
2012-11-15 09:23:39 +00:00
$(this).text("OFF");
$(this).siblings(".subrole_disable_field").val("true");
2012-11-15 09:23:39 +00:00
}else{
$(this).text("ON");
$(this).siblings(".subrole_disable_field").val("false");
2012-11-15 09:23:39 +00:00
}
2013-01-18 02:37:55 +00:00
// checkSwitch();
2012-11-15 09:23:39 +00:00
}
return false;
});
});