Plugin Directory

Changeset 2060340


Ignore:
Timestamp:
03/31/2019 07:02:31 AM (7 years ago)
Author:
evilex
Message:

Version: 1.1.7

Location:
yummi-auto-check-parent-category-category-tree-checklist/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • yummi-auto-check-parent-category-category-tree-checklist/trunk/readme.txt

    r2060094 r2060340  
    88Requires at least: 3.3
    99Tested up to: 5.0
    10 Stable tag: 1.1.6
     10Stable tag: 1.1.7
    1111License: GPLv2 or later
    1212License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3333
    3434== Changelog ==
     35
     36= 1.1.7 =
     37* Fixed "Allow UnCheck Parents"
    3538
    3639= 1.1.6 =
  • yummi-auto-check-parent-category-category-tree-checklist/trunk/yummi-category-checklist.php

    r2060094 r2060340  
    22/*
    33Plugin Name: Parent Category AutoCheck + Category Tree Checklist
    4 Version: 1.1.6
     4Version: 1.1.7
    55Description: Preserves the category hierarchy on the post editing screen + Check Parent Automatically + Auto scroll to first checked
    66Author: Alex Egorov
     
    206206                    // });
    207207
     208                    <?php if( $cchl['collapse'] == 1 ){ ?>
     209                        /* add +/- to colapce categories */
     210                        $('.categorychecklist .li').each(function(){
     211                            if($(this).find('.children').length){
     212                                $(this).addClass('is-parent');
     213                                if($(this).find('.toggler').length){
     214                                    $(this).find('.toggler').detach(); //$('.categorychecklist .li .toggler').remove();
     215                                    $(this).prepend('<span class="toggler"></span>');
     216                                }else{
     217                                    $(this).prepend('<span class="toggler"></span>');
     218                                }
     219                            }
     220                        });
     221                        $('.categorychecklist .li .toggler').click(function(){
     222                            $(this).parent().toggleClass('open');
     223                        });
     224                    <?php } else { ?>
     225                        $('.categorychecklist .li').each(function(){
     226                            if($(this).find('.children').length)
     227                                $(this).addClass('is-parent');
     228                        });
     229                    <?php } ?>
     230
    208231                    /* Чекаем главную категорию если чаилд выбран */
    209                     $('.categorychecklist .li:not(.is-parent) :checkbox, [data-taxonomy="category"] .acf-checkbox-list .li .children .li :checkbox').on('change',function(e){
     232                    $('.categorychecklist .li<?php echo $cchl['UncheckMain'] == 1 ? ':not(.is-parent)' : null?> :checkbox, [data-taxonomy="category"] .acf-checkbox-list .li .children .li :checkbox').on('change',function(e){
    210233                        /* on('change' - работает при сохранении, on('click' - не работает при сохранении но правильно работает выделение родителей */
    211234                    var n = $(this).first().find("input:checked").length; // $(this).parent().parent().parent().find("input:checked").length
     
    273296                                        } ?>
    274297                                });
     298                                // if($(this).parent().parent().hasClass("is-parent")){
     299                                //  console.log('is-parent clicked!');
     300                                //  $(this).prop('checked', !($(this).is(':checked')));
     301                                // }
    275302                            }
    276303                        }
     
    278305                  });
    279306
    280                     <?php if( $cchl['collapse'] == 1 ){ ?>
    281                         /* add +/- to colapce categories */
    282                         $('.categorychecklist .li').each(function(){
    283                             if($(this).find('.children').length){
    284                                 $(this).addClass('is-parent');
    285                                 if($(this).find('.toggler').length){
    286                                     $(this).find('.toggler').detach(); //$('.categorychecklist .li .toggler').remove();
    287                                     $(this).prepend('<span class="toggler"></span>');
    288                                 }else{
    289                                     $(this).prepend('<span class="toggler"></span>');
    290                                 }
    291                             }
    292                         });
    293                         $('.categorychecklist .li .toggler').click(function(){
    294                             $(this).parent().toggleClass('open');
    295                         });
    296                     <?php } else { ?>
    297                         $('.categorychecklist .li').each(function(){
    298                             if($(this).find('.children').length)
    299                                 $(this).addClass('is-parent');
    300                         });
    301                     <?php } ?>
    302307                    <?php if( $cchl['collapse_acf'] == 1 ){ ?>
    303308                        /* add +/- to ACF colapce categories */
     
    454459            <?php echo $beforeRow ?>
    455460
    456                 <label for="UncheckMain"><?php _e('Allow UnCheck Parents','cchl')?>:<br/>&emsp;<small><?php _e('found max child levels','cchl');?>: <?php echo $depth;?></small></label>
     461                <label for="UncheckMain"><?php _e('Allow UnCheck Parents','cchl')?>:<br/><small>- <i><?php _e('no auto check for parents','cchl')?></i> -</small><br/>&emsp;<small><?php _e('found max child levels','cchl');?>: <?php echo $depth;?></small></label>
    457462            <?php echo $betweenRow ?>
    458463                <input type="checkbox" id="UncheckMain" name="UncheckMain" <?php checked( $cchl['UncheckMain'], 1 ); ?>/>
Note: See TracChangeset for help on using the changeset viewer.