]> WPIA git - gigi.git/blobdiff - static/static/js/expert.js
add: make name selection exclusive.
[gigi.git] / static / static / js / expert.js
index 09987b170124e1ab14859d96400319a63d59379a..07d1da4976d809d1a6b4474583efd528fdb6a003 100644 (file)
                $(".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;
                });
        }