X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=static%2Fstatic%2Fjs%2Fexpert.js;fp=static%2Fstatic%2Fjs%2Fexpert.js;h=07d1da4976d809d1a6b4474583efd528fdb6a003;hp=09987b170124e1ab14859d96400319a63d59379a;hb=ab9818f784c71e0f75c1c1dd621da8a3a88cffa4;hpb=2a62920f111cb873e4b67ca57449f95e654a96e2 diff --git a/static/static/js/expert.js b/static/static/js/expert.js index 09987b17..07d1da49 100644 --- a/static/static/js/expert.js +++ b/static/static/js/expert.js @@ -20,14 +20,27 @@ $(".panel-activatable").map(function() { var panel = $(this); var refresh = function(){ - if(this.checked){ + var radio = this.type == "radio"; + if(radio && this.form.currentRadios === undefined) { + this.form.currentRadios = {}; + } + if(this.checked) { panel.find(".panel-body").removeClass("hidden"); - }else{ + if(radio) { + var rds = this.form.currentRadios; + if(rds[this.name] !== undefined){ + $(rds[this.name]).trigger("change"); + } + rds[this.name] = this; + } + } else { panel.find(".panel-body").addClass("hidden"); } }; panel.find(".panel-heading [type=\"checkbox\"]").map(refresh); - panel.find(".panel-heading [type=\"checkbox\"]").click(refresh); + panel.find(".panel-heading [type=\"checkbox\"]").change(refresh); + panel.find(".panel-heading [type=\"radio\"]").map(refresh); + panel.find(".panel-heading [type=\"radio\"]").change(refresh); return this.id; }); }