Changeset 2060340
- Timestamp:
- 03/31/2019 07:02:31 AM (7 years ago)
- Location:
- yummi-auto-check-parent-category-category-tree-checklist/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (2 diffs)
-
yummi-category-checklist.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
yummi-auto-check-parent-category-category-tree-checklist/trunk/readme.txt
r2060094 r2060340 8 8 Requires at least: 3.3 9 9 Tested up to: 5.0 10 Stable tag: 1.1. 610 Stable tag: 1.1.7 11 11 License: GPLv2 or later 12 12 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 33 33 34 34 == Changelog == 35 36 = 1.1.7 = 37 * Fixed "Allow UnCheck Parents" 35 38 36 39 = 1.1.6 = -
yummi-auto-check-parent-category-category-tree-checklist/trunk/yummi-category-checklist.php
r2060094 r2060340 2 2 /* 3 3 Plugin Name: Parent Category AutoCheck + Category Tree Checklist 4 Version: 1.1. 64 Version: 1.1.7 5 5 Description: Preserves the category hierarchy on the post editing screen + Check Parent Automatically + Auto scroll to first checked 6 6 Author: Alex Egorov … … 206 206 // }); 207 207 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 208 231 /* Чекаем главную категорию если чаилд выбран */ 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){ 210 233 /* on('change' - работает при сохранении, on('click' - не работает при сохранении но правильно работает выделение родителей */ 211 234 var n = $(this).first().find("input:checked").length; // $(this).parent().parent().parent().find("input:checked").length … … 273 296 } ?> 274 297 }); 298 // if($(this).parent().parent().hasClass("is-parent")){ 299 // console.log('is-parent clicked!'); 300 // $(this).prop('checked', !($(this).is(':checked'))); 301 // } 275 302 } 276 303 } … … 278 305 }); 279 306 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 } ?>302 307 <?php if( $cchl['collapse_acf'] == 1 ){ ?> 303 308 /* add +/- to ACF colapce categories */ … … 454 459 <?php echo $beforeRow ?> 455 460 456 <label for="UncheckMain"><?php _e('Allow UnCheck Parents','cchl')?>:<br/>  <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/> <small><?php _e('found max child levels','cchl');?>: <?php echo $depth;?></small></label> 457 462 <?php echo $betweenRow ?> 458 463 <input type="checkbox" id="UncheckMain" name="UncheckMain" <?php checked( $cchl['UncheckMain'], 1 ); ?>/>
Note: See TracChangeset
for help on using the changeset viewer.