@@ -29,25 +29,36 @@ QueryBuilder.define('invert', function(options) {
2929 } ) ;
3030
3131 // Modify templates
32- this . on ( 'getGroupTemplate.filter' , function ( h , level ) {
33- var $h = $ ( h . value ) ;
34- $h . find ( Selectors . condition_container ) . after ( '<button type="button" class="btn btn-xs btn-default" data-invert="group"><i class="' + options . icon + '"></i> ' + self . translate ( 'invert' ) + '</button>' ) ;
35- h . value = $h . prop ( 'outerHTML' ) ;
36- } ) ;
37-
38- if ( options . display_rules_button && options . invert_rules ) {
39- this . on ( 'getRuleTemplate.filter' , function ( h ) {
32+ if ( ! options . disable_template ) {
33+ this . on ( 'getGroupTemplate.filter' , function ( h ) {
4034 var $h = $ ( h . value ) ;
41- $h . find ( Selectors . rule_actions ) . prepend ( '<button type="button" class="btn btn-xs btn-default" data-invert="rule"><i class="' + options . icon + '"></i> ' + self . translate ( 'invert' ) + '</button>' ) ;
35+ $h . find ( Selectors . condition_container ) . after (
36+ '<button type="button" class="btn btn-xs btn-default" data-invert="group">' +
37+ '<i class="' + options . icon + '"></i> ' + self . translate ( 'invert' ) +
38+ '</button>'
39+ ) ;
4240 h . value = $h . prop ( 'outerHTML' ) ;
4341 } ) ;
42+
43+ if ( options . display_rules_button && options . invert_rules ) {
44+ this . on ( 'getRuleTemplate.filter' , function ( h ) {
45+ var $h = $ ( h . value ) ;
46+ $h . find ( Selectors . rule_actions ) . prepend (
47+ '<button type="button" class="btn btn-xs btn-default" data-invert="rule">' +
48+ '<i class="' + options . icon + '"></i> ' + self . translate ( 'invert' ) +
49+ '</button>'
50+ ) ;
51+ h . value = $h . prop ( 'outerHTML' ) ;
52+ } ) ;
53+ }
4454 }
4555} , {
4656 icon : 'glyphicon glyphicon-random' ,
4757 recursive : true ,
4858 invert_rules : true ,
4959 display_rules_button : false ,
50- silent_fail : false
60+ silent_fail : false ,
61+ disable_template : false
5162} ) ;
5263
5364QueryBuilder . defaults ( {
0 commit comments