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

?>
<modal is-modal-hidden="settingsOverlayVisibility" modal-title="{{item.title}} <?= Module::t('cmsadmin_settings_modal_title'); ?>">
<div class="row" ng-if="!settingsOverlayVisibility">
    <div class="col-md-3">
        <ul class="nav nav-pills flex-column">
            <li class="nav-item">
                <a class="nav-link nav-link-icon" ng-click="changeTab(1)" ng-class="{'active':tab==1}"><i class="material-icons">title</i><span><?= Module::t('cmsadmin_item_settings_titleslug'); ?></a>
            </li>
            <li class="nav-item">
                <a class="nav-link nav-link-icon" ng-click="changeTab(3)" ng-class="{'active':tab==3}"><i class="material-icons">change_history</i><span><?= Module::t('version_create_title'); ?></span></a>
            </li>
            <li class="nav-item">
                <a class="nav-link nav-link-icon" ng-click="changeTab(2)" ng-class="{'active':tab==2}"><i class="material-icons">track_changes</i><span><?= Module::t('versions_selector'); ?></span></a>
            </li>
            <li><hr /></li>
            <li ng-repeat="(key, versionItem) in typeData">
                <a class="nav-link" ng-class="{'active' : editVersionItem.id == versionItem.id && tab == 4}" ng-click="editVersion(versionItem)"><span class="badge badge-secondary">V{{$index+1}}</span> {{versionItem.version_alias}}</a>
            </li>
        </ul>
    </div>
    <div class="col-md-9" ng-switch="tab">
        <div ng-switch-when="1">
            <h1><?= Module::t('cmsadmin_item_settings_titleslug'); ?></h1>
            <form ng-submit="updateNavItemData(itemCopy, typeDataCopy)" ng-switch on="itemCopy.nav_item_type">
                <zaa-text model="itemCopy.title" label="<?= Module::t('view_index_page_title'); ?>" />
                <zaa-text model="itemCopy.alias" label="<?= Module::t('view_index_page_alias'); ?>" />
                <zaa-text model="itemCopy.title_tag" label="<?= Module::t('model_navitem_title_tag_label'); ?>" />
                <zaa-textarea model="itemCopy.description" label="<?= Module::t('view_index_page_meta_description'); ?>" />
                <zaa-textarea model="itemCopy.keywords" label="<?= Module::t('view_index_page_meta_keywords'); ?>" />
                <div ng-switch-when="1">
                    <update-form-page data="typeDataCopy"></update-form-page>
                </div>
                <div ng-switch-when="2">
                    <update-form-module data="typeDataCopy"></update-form-module>
                </div>
                <div ng-switch-when="3">
                    <update-form-redirect data="typeDataCopy"></update-form-redirect>
                </div>
                
                <button style="margin-top:15px;" type="submit" class="btn btn-icon btn-save"><?= Module::t('btn_save'); ?></button>
            </form>
        </div>
        <div ng-switch-when="2">
            <h1><?= Module::t('versions_selector'); ?></h1>
            <table class="table table-bordered table-responsive">
                <tr>
                    <th><?= Module::t('version_input_name'); ?></th>
                    <th><?= Module::t('version_input_layout'); ?></th>
                    <th colspan="3"><?= Module::t('cmsadmin_created_at'); ?></th>
                </tr>
                <tr ng-repeat="versionItem in typeData" ng-class="{'table-success' : currentPageVersion == versionItem.id}">
                    <td>{{versionItem.version_alias}}</td>
                    <td>{{versionItem.contentAsArray.nav_item_page.layout_name}}</td>
                    <td>{{versionItem.timestamp_create | date :'short'}}</td>
                    <td>
                        <button type="button" class="btn btn-symbol btn-sm btn-outline-secondary" ng-click="editVersion(versionItem)"><i class="material-icons">edit</i></button>
                        <button type="button" class="btn btn-delete btn-icon btn-nolabel" ng-if="currentPageVersion != versionItem.id" ng-click="removeVersion(versionItem)"></button>
                    </td>
                </tr>
            </table>
        </div>
        <div ng-switch-when="4">
            <h1><?= Module::t('version_edit_title'); ?> <span class="badge badge-secondary">{{editVersionItem.version_alias}}</span></h1>
            <h2></h2>
            <zaa-text model="editVersionItem.version_alias" label="<?= Module::t('version_input_name'); ?>" />
            <zaa-select model="editVersionItem.layout_id" label="<?= Module::t('version_input_layout'); ?>" options="layoutsData" optionsvalue="id" optionslabel="name" />
            <button type="button" class="btn btn-save btn-icon" ng-click="editVersionUpdate(editVersionItem)"><?= Module::t('btn_save'); ?></button>
        </div>
        <div ng-switch-when="3" ng-controller="PageVersionsController">
            <form ng-submit="createNewVersionSubmit(create)">
                <h2><?= Module::t('version_create_title'); ?></h2>
                <div class="alert alert-info"><?= Module::t('version_create_info'); ?></div>
                <zaa-text model="create.versionName" label="<?= Module::t('version_input_name'); ?>" />

                <div class="form-group">
                    <div class="form-check">
                        <input id="copyExistingVersion" name="radio" type="radio" ng-checked="create.copyExistingVersion" />
                        <label for="copyExistingVersion" ng-click="create.copyExistingVersion=true"><?= Module::t('version_create_copy'); ?></label>
                    </div>
                    <div class="form-check">
                        <input id="createNewVersion" name="radio" type="radio" ng-checked="!create.copyExistingVersion" />
                        <label for="createNewVersion" ng-click="create.copyExistingVersion=false"><?= Module::t('version_create_new'); ?></label>
                    </div>
                </div>

                <div ng-show="create.copyExistingVersion" class="form-group">
                    <label><?= Module::t('version_input_copy_chooser'); ?></label>
                    <select class="form-control" ng-model="create.fromVersionPageId" ng-options="versionItem.id as versionItem.version_alias for versionItem in typeData"></select>
                </div>
                <zaa-select ng-show="!create.copyExistingVersion" model="create.versionLayoutId" label="<?= Module::t('version_input_layout'); ?>" options="layoutsData" optionslabel="name" optionsvalue="id" />
                <button class="btn btn-save btn-icon" type="submit"><?= Module::t('button_create_version'); ?></button>
            </form>
        </div>
    </div>
</div>
</modal><commit_msg>add badge to current active version in version overview<commit_after><?php
use luya\cms\admin\Module;

?>
<modal is-modal-hidden="settingsOverlayVisibility" modal-title="{{item.title}} <?= Module::t('cmsadmin_settings_modal_title'); ?>">
<div class="row" ng-if="!settingsOverlayVisibility">
    <div class="col-md-3">
        <ul class="nav nav-pills flex-column">
            <li class="nav-item">
                <a class="nav-link nav-link-icon" ng-click="changeTab(1)" ng-class="{'active':tab==1}"><i class="material-icons">title</i><span><?= Module::t('cmsadmin_item_settings_titleslug'); ?></a>
            </li>
            <li class="nav-item">
                <a class="nav-link nav-link-icon" ng-click="changeTab(3)" ng-class="{'active':tab==3}"><i class="material-icons">change_history</i><span><?= Module::t('version_create_title'); ?></span></a>
            </li>
            <li class="nav-item">
                <a class="nav-link nav-link-icon" ng-click="changeTab(2)" ng-class="{'active':tab==2}"><i class="material-icons">track_changes</i><span><?= Module::t('versions_selector'); ?></span></a>
            </li>
            <li><hr /></li>
            <li ng-repeat="(key, versionItem) in typeData">
                <a class="nav-link" ng-class="{'active' : editVersionItem.id == versionItem.id && tab == 4}" ng-click="editVersion(versionItem)"><span class="badge badge-secondary">V{{$index+1}}</span> {{versionItem.version_alias}}</a>
            </li>
        </ul>
    </div>
    <div class="col-md-9" ng-switch="tab">
        <div ng-switch-when="1">
            <h1><?= Module::t('cmsadmin_item_settings_titleslug'); ?></h1>
            <form ng-submit="updateNavItemData(itemCopy, typeDataCopy)" ng-switch on="itemCopy.nav_item_type">
                <zaa-text model="itemCopy.title" label="<?= Module::t('view_index_page_title'); ?>" />
                <zaa-text model="itemCopy.alias" label="<?= Module::t('view_index_page_alias'); ?>" />
                <zaa-text model="itemCopy.title_tag" label="<?= Module::t('model_navitem_title_tag_label'); ?>" />
                <zaa-textarea model="itemCopy.description" label="<?= Module::t('view_index_page_meta_description'); ?>" />
                <zaa-textarea model="itemCopy.keywords" label="<?= Module::t('view_index_page_meta_keywords'); ?>" />
                <div ng-switch-when="1">
                    <update-form-page data="typeDataCopy"></update-form-page>
                </div>
                <div ng-switch-when="2">
                    <update-form-module data="typeDataCopy"></update-form-module>
                </div>
                <div ng-switch-when="3">
                    <update-form-redirect data="typeDataCopy"></update-form-redirect>
                </div>
                
                <button style="margin-top:15px;" type="submit" class="btn btn-icon btn-save"><?= Module::t('btn_save'); ?></button>
            </form>
        </div>
        <div ng-switch-when="2">
            <h1><?= Module::t('versions_selector'); ?></h1>
            <table class="table table-bordered table-responsive">
                <tr>
                    <th><?= Module::t('version_input_name'); ?></th>
                    <th><?= Module::t('version_input_layout'); ?></th>
                    <th colspan="3"><?= Module::t('cmsadmin_created_at'); ?></th>
                </tr>
                <tr ng-repeat="versionItem in typeData" ng-class="{'table-success' : currentPageVersion == versionItem.id}">
                    <td>{{versionItem.version_alias}} <span class="badge badge-primary" ng-if="currentPageVersion == versionItem.id"><?= Module::t('view_index_page_version_chooser'); ?></span></td>
                    <td>{{versionItem.contentAsArray.nav_item_page.layout_name}}</td>
                    <td>{{versionItem.timestamp_create | date :'short'}}</td>
                    <td>
                        <button type="button" class="btn btn-symbol btn-sm btn-outline-secondary" ng-click="editVersion(versionItem)"><i class="material-icons">edit</i></button>
                        <button type="button" class="btn btn-delete btn-icon btn-nolabel" ng-if="currentPageVersion != versionItem.id" ng-click="removeVersion(versionItem)"></button>
                    </td>
                </tr>
            </table>
        </div>
        <div ng-switch-when="4">
            <h1><?= Module::t('version_edit_title'); ?> <span class="badge badge-secondary">{{editVersionItem.version_alias}}</span></h1>
            <h2></h2>
            <zaa-text model="editVersionItem.version_alias" label="<?= Module::t('version_input_name'); ?>" />
            <zaa-select model="editVersionItem.layout_id" label="<?= Module::t('version_input_layout'); ?>" options="layoutsData" optionsvalue="id" optionslabel="name" />
            <button type="button" class="btn btn-save btn-icon" ng-click="editVersionUpdate(editVersionItem)"><?= Module::t('btn_save'); ?></button>
        </div>
        <div ng-switch-when="3" ng-controller="PageVersionsController">
            <form ng-submit="createNewVersionSubmit(create)">
                <h2><?= Module::t('version_create_title'); ?></h2>
                <div class="alert alert-info"><?= Module::t('version_create_info'); ?></div>
                <zaa-text model="create.versionName" label="<?= Module::t('version_input_name'); ?>" />

                <div class="form-group">
                    <div class="form-check">
                        <input id="copyExistingVersion" name="radio" type="radio" ng-checked="create.copyExistingVersion" />
                        <label for="copyExistingVersion" ng-click="create.copyExistingVersion=true"><?= Module::t('version_create_copy'); ?></label>
                    </div>
                    <div class="form-check">
                        <input id="createNewVersion" name="radio" type="radio" ng-checked="!create.copyExistingVersion" />
                        <label for="createNewVersion" ng-click="create.copyExistingVersion=false"><?= Module::t('version_create_new'); ?></label>
                    </div>
                </div>

                <div ng-show="create.copyExistingVersion" class="form-group">
                    <label><?= Module::t('version_input_copy_chooser'); ?></label>
                    <select class="form-control" ng-model="create.fromVersionPageId" ng-options="versionItem.id as versionItem.version_alias for versionItem in typeData"></select>
                </div>
                <zaa-select ng-show="!create.copyExistingVersion" model="create.versionLayoutId" label="<?= Module::t('version_input_layout'); ?>" options="layoutsData" optionslabel="name" optionsvalue="id" />
                <button class="btn btn-save btn-icon" type="submit"><?= Module::t('button_create_version'); ?></button>
            </form>
        </div>
    </div>
</div>
</modal>
{'fraction_non_alphanumeric': 0.1886291571418037, 'fraction_numerical': 0.004424452474006342, 'mean_word_length': 2.5925827814569535, 'pattern_counts': {'":': 0, '<': 340, '<?xml version=': 0, '>': 340, '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': '2137817', 'n_tokens_mistral': 4035, 'n_tokens_neox': 3961, 'n_words': 602}