Files
orbit-basic/app/assets/Archive/javascripts/inc/attribute_onoff.js
T
chris 856898016b New UI changes(tags, categories, authorisations, module index…)
To run:
  - ruby lib/remove_old_tags.rb DB_NAME
  - rake new_ui:migrate_tags
  - rake new_ui:migrate_categories['APP_KEY,''MODEL_NAME'] (check new_ui.rake for more details)
2013-07-02 16:46:44 +08:00

38 lines
1.5 KiB
JavaScript

function checkSwitch() {
// $(".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();
$('.onoff').click(function () {
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")){
$(this).text("OFF");
$(this).siblings(".subrole_disable_field").val("true");
}else{
$(this).text("ON");
$(this).siblings(".subrole_disable_field").val("false");
}
}
if($(this).parent("legend").length==1) {
$(this).toggleClass("disabled");
$(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();
}
return false;
});
});