Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[addon] Page-list Tree for admin
#1
I've got a lot of sub-pages on my site, and you know, it's a headache to access them (even with FILTER)
So I wrote a simple script to add collapse/expand-functionality to page-list.

All you need to open admin/pages.php, find this line:
Code:
<?php get_template('footer'); ?>
And add this script right above it:
Code:
<style>
.pagetitle { position:relative; }
.l-1 .switch {left: 5px;}
.l-2 .switch {left: 25px;}
.l-3 .switch {left: 45px;}
.l-4 .switch {left: 65px;}
.switch {
  width: 15px;
  height: 15px;
  background: url('template/images/plus.png') no-repeat center center #182227;
  position: absolute;
  left: -15px;
  top:6px;
  border-radius:3px;
  cursor:pointer;
}
.switch:hover {background-color: #CF3805;}
.switch.on {background: url('template/images/minus.png') no-repeat center center #CF3805;}
</style>

<script>
$(document).ready(function(){
    $('#editpages tr').attr('rel',0).addClass('l-0');
    $('.pagetitle span').not('.showstatus').each(function(i,e){
        $tr = $(this).parent().parent();
        var level = $tr.find('.pagetitle span').not('.showstatus').size();
        $tr.attr('rel',level);
        $tr.attr('class','hidden l-'+level);
    });
    
    $('#editpages tr.hidden').each(function(i,e){
        if ( parseInt($(this).prev().attr('rel')) < parseInt($(this).attr('rel')) ) $(this).prev().find('.pagetitle').prepend('<div class="switch"></div>');
    });
    
    $('.pagetitle').on('click','.switch',function(){
        
        $tr = $(this).parent().parent();
        var lvl = parseInt($tr.attr('rel'));
        
        if ($(this).hasClass('on'))
        $tr.nextUntil('.l-'+lvl).addClass('hidden').find('.switch.on').removeClass('on');
        else
        $tr.nextUntil('.l-'+lvl,'.l-'+(lvl+1)).removeClass('hidden');
        
        $(this).toggleClass('on');
    });
});
</script>
Tested with GS 3.3.4
Reply


Messages In This Thread
[addon] Page-list Tree for admin - by andy-man - 2015-06-25, 05:03:05
RE: [addon] Page-list Tree for admin - by Carlos - 2015-06-26, 00:15:56
RE: [addon] Page-list Tree for admin - by Oleg06 - 2015-06-26, 05:35:18
RE: [addon] Page-list Tree for admin - by Tyblitz - 2015-06-29, 21:24:59



Users browsing this thread: 1 Guest(s)