<commit_before><?php
use \luya\cms\admin\Module;

?>
<style>
<!--
.b-top { border-top:2px solid red; }
.b-bottom { border-bottom:2px solid red; }
.b-left { border-left:2px solid red; }
.b-hover { background-color:green; }
-->
</style>
<?= $this->render('_angulardirectives'); ?>
<script type="text/ng-template" id="reverse2.html">
    <span class="treeview__label treeview__label--page" ng-click="go(data)" dnd dnd-model="data" dnd-ondrop="dropItem(dragged,dropped,position)" dnd-isvalid="validItem(hover,dragged)" dnd-css="{onDrag: 'make-drag', onHover: 'b-hover', onHoverTop: 'b-top', onHoverMiddle: 'b-left', onHoverBottom: 'b-bottom'}">
        <span class="treeview__icon treeview__icon--collapse" ng-show="(menuData.items | menuparentfilter:catitem.id:data.id).length">
            <i class="material-icons">arrow_drop_down</i>
        </span>
        <span class="treeview__icon treeview__icon--right" ng-if="data.is_home==1">
            <i class="material-icons">home</i>
        </span>
        <span class="treeview__link">
            <span class="google-chrome-font-offset-fix">{{data.title}}</span>
        </span>
    </span>
    <ul class="treeview__items">
        <li class="treeview__item" ng-class="{'treeview__item--isoffline' : data.is_offline, 'treeview__item--ishidden': data.is_hidden, 'treeview__item--has-children' : (menuData.items | menuparentfilter:catitem.id:data.id).length}" ng-repeat="data in menuData.items | menuparentfilter:catitem.id:data.id" ng-include="'reverse2.html'" />
    </ul>
</script>
<div class="luya__subnav">
    <div class="cmsnav" ng-controller="CmsMenuTreeController">
        <ul class="cmsnav__list cmsnav__list--buttons">
            <?php if (Yii::$app->adminuser->canRoute('cmsadmin/page/create')): ?>
            <li class="cmsnav__button" ui-sref="custom.cmsadd">
                <div class="btn btn-block text-left btn-success">
                    <span class="material-icons">add_box</span>
                    <span class="btn-icon-label"><?= Module::t('view_index_sidebar_new_page'); ?></span>
                </div>
            </li>
            <?php endif; ?>
            <?php if (Yii::$app->adminuser->canRoute('cmsadmin/page/drafts')): ?>
            <li class="cmsnav__button" ui-sref="custom.cmsdraft">
                <div class="btn btn-block text-left btn-info">
                    <span class="material-icons">receipt</span>
                    <span class="btn-icon-label"><?= Module::t('view_index_sidebar_drafts'); ?></span>
                </div>
            </li>
            <?php endif; ?>
        </ul>
        <ul class="cmsnav__list cmsnav__list--switches">
            <li class="cmsnav__switch">
                <label class="switch" for="switch-live-preview">
                    <span class="switch__switch">
                        <input class="switch__checkbox" type="checkbox" id="switch-live-preview"/>
                        <span class="switch__control" for="switch-live-preview"></span>
                    </span>
                    <span class="switch__label">
                        Live preview
                    </span>
                </label>
            </li>
        </ul>
        <ul class="cmsnav__list cmsnav__list--treeview treeview"> 
            <li class="treeview__container"  ng-repeat="catitem in menuData.containers" >
                <div class="treeview__label treeview__label--container">
                    <span class="treeview__icon treeview__icon--collapse">
                        <i class="material-icons">keyboard_arrow_down</i>
                    </span>
                    <span class="treeview__link"><span class="google-chrome-font-offset-fix">{{catitem.alias}}</span></span>
                </div>
                <ul class="treeview__items">
                    <li class="treeview__item" ng-class="{'treeview__item--isoffline' : data.is_offline, 'treeview__item--ishidden': data.is_hidden, 'treeview__item--has-children' : (menuData.items | menuparentfilter:catitem.id:data.id).length}" ng-repeat="data in menuData.items | menuparentfilter:catitem.id:0" ng-include="'reverse2.html'" />
                </ul>
            </li>
        </ul><commit_msg>add ability to collapse cms tree<commit_after><?php
use \luya\cms\admin\Module;

?>
<style>
<!--
.b-top { border-top:2px solid red; }
.b-bottom { border-bottom:2px solid red; }
.b-left { border-left:2px solid red; }
.b-hover { background-color:green; }
-->
</style>
<?= $this->render('_angulardirectives'); ?>
<script type="text/ng-template" id="reverse2.html">
    <span class="treeview__label treeview__label--page" dnd dnd-model="data" dnd-ondrop="dropItem(dragged,dropped,position)" dnd-isvalid="validItem(hover,dragged)" dnd-css="{onDrag: 'make-drag', onHover: 'b-hover', onHoverTop: 'b-top', onHoverMiddle: 'b-left', onHoverBottom: 'b-bottom'}">
        <span class="treeview__icon treeview__icon--collapse" ng-show="(menuData.items | menuparentfilter:catitem.id:data.id).length"  ng-click="toggleItem(data)">
            <i class="material-icons">arrow_drop_down</i>
        </span>
        <span class="treeview__icon treeview__icon--right" ng-if="data.is_home==1">
            <i class="material-icons">home</i>
        </span>
        <span class="treeview__link" ng-click="go(data)" >
            <span class="google-chrome-font-offset-fix">{{data.title}}</span>
        </span>
    </span>
    <ul class="treeview__items">
        <li class="treeview__item" ng-class="{'treeview__item--isoffline' : data.is_offline, 'treeview__item--collapsed': !data.toggle_open, 'treeview__item--ishidden': data.is_hidden, 'treeview__item--has-children' : (menuData.items | menuparentfilter:catitem.id:data.id).length}" ng-repeat="data in menuData.items | menuparentfilter:catitem.id:data.id" ng-include="'reverse2.html'" />
    </ul>
</script>
<div class="luya__subnav">
    <div class="cmsnav" ng-controller="CmsMenuTreeController">
        <ul class="cmsnav__list cmsnav__list--buttons">
            <?php if (Yii::$app->adminuser->canRoute('cmsadmin/page/create')): ?>
            <li class="cmsnav__button" ui-sref="custom.cmsadd">
                <div class="btn btn-block text-left btn-success">
                    <span class="material-icons">add_box</span>
                    <span class="btn-icon-label"><?= Module::t('view_index_sidebar_new_page'); ?></span>
                </div>
            </li>
            <?php endif; ?>
            <?php if (Yii::$app->adminuser->canRoute('cmsadmin/page/drafts')): ?>
            <li class="cmsnav__button" ui-sref="custom.cmsdraft">
                <div class="btn btn-block text-left btn-info">
                    <span class="material-icons">receipt</span>
                    <span class="btn-icon-label"><?= Module::t('view_index_sidebar_drafts'); ?></span>
                </div>
            </li>
            <?php endif; ?>
        </ul>
        <ul class="cmsnav__list cmsnav__list--switches">
            <li class="cmsnav__switch">
                <label class="switch" for="switch-live-preview">
                    <span class="switch__switch">
                        <input class="switch__checkbox" type="checkbox" id="switch-live-preview"/>
                        <span class="switch__control" for="switch-live-preview"></span>
                    </span>
                    <span class="switch__label">
                        Live preview
                    </span>
                </label>
            </li>
        </ul>
        <ul class="cmsnav__list cmsnav__list--treeview treeview"> 
            <li class="treeview__container"  ng-repeat="catitem in menuData.containers" >
                <div class="treeview__label treeview__label--container">
                    <span class="treeview__icon treeview__icon--collapse">
                        <i class="material-icons">keyboard_arrow_down</i>
                    </span>
                    <span class="treeview__link"><span class="google-chrome-font-offset-fix">{{catitem.alias}}</span></span>
                </div>
                <ul class="treeview__items">
                    <li class="treeview__item" ng-class="{'treeview__item--isoffline' : data.is_offline, 'treeview__item--collapsed': !data.toggle_open, 'treeview__item--ishidden': data.is_hidden, 'treeview__item--has-children' : (menuData.items | menuparentfilter:catitem.id:data.id).length}" ng-repeat="data in menuData.items | menuparentfilter:catitem.id:0" ng-include="'reverse2.html'" />
                </ul>
            </li>
        </ul>
{'fraction_non_alphanumeric': 0.16485189087928814, 'fraction_numerical': 0.0018733169418100925, 'mean_word_length': 2.5094494658997535, 'pattern_counts': {'":': 0, '<': 163, '<?xml version=': 0, '>': 173, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3304584', 'n_tokens_mistral': 2683, 'n_tokens_neox': 2602, 'n_words': 405}