{% extends 'partials/base.html.twig' %} {% macro spanToggle(input, length) %} {{ (repeat('  ', (length - input|length) / 2) ~ input ~ repeat('  ', (length - input|length) / 2))|raw }} {% endmacro %} {% macro loop(page, depth, twig_vars) %} {% import _self as self %} {% set config = twig_vars['config'] %} {% set separator = config.system.param_sep %} {% set display_field = config.plugins.admin.pages_list_display_field %} {% set base_url_relative_frontend = twig_vars['base_url_relative_frontend'] %} {% set admin = twig_vars['admin'] %} {% set warn = twig_vars['warn'] %} {% set uri = twig_vars['uri'] %} {% if page.header.admin.children_display_order == 'collection' and page.header.content.order.by %} {% if page.header.content.order.custom %} {% set pcol = page.children().order(page.header.content.order.by, page.header.content.order.dir|default('asc'), page.header.content.order.custom) %} {% else %} {% set pcol = page.children().order(page.header.content.order.by, page.header.content.order.dir|default('asc')) %} {% endif %} {% else %} {% set pcol = page.children() %} {% endif %} {% for p in pcol %} {% set description = (not p.page ? "PLUGIN_ADMIN.FOLDER"|tu ~ ' • ' : "PLUGIN_ADMIN.PAGE"|tu ~ ' • ') ~ (p.isModule ? "PLUGIN_ADMIN.MODULE"|tu ~ ' • ' : '') ~ (p.routable ? "PLUGIN_ADMIN.ROUTABLE"|tu ~ ' • ' : "PLUGIN_ADMIN.NON_ROUTABLE"|tu ~ ' • ') ~ (p.visible ? "PLUGIN_ADMIN.VISIBLE"|tu ~ ' • ' : "PLUGIN_ADMIN.NON_VISIBLE"|tu ~ ' • ') ~ (p.published ? "PLUGIN_ADMIN.PUBLISHED"|tu ~ ' • ' : "PLUGIN_ADMIN.NON_PUBLISHED"|tu ~ ' • ') %} {% set page_url = getPageUrl(p) %}
  • 0 ? 'data-toggle="children"' : ''}}>
    {% set page_label = attribute(p.header, display_field)|defined(attribute(p, display_field))|defined(p.title)|default(p.slug|titleize) %} {{ page_label|e }} {% if p.language %} {{p.language}} {% endif %} {% if p.home %} {% endif %}

    {{ p.header.routes.default ?: p.route }} {{ p.template() }}

    {% if config.plugins.admin.frontend_preview_target != 'inline' %} {% set preview_target = config.plugins.admin.frontend_preview_target %} {% set preview_route = (base_url_relative_frontend|rtrim('/') ~ (p.home ? '' : p.route)) ?: '/' %} {% set preview_link = p.routable ? ' ' : '' %} {% else %} {% set preview_route = admin_route('/preview' ~ (p.home ? '' : p.route)) %} {% set preview_link = p.routable ? ' ' : '' %} {% endif %} {{ preview_link|raw }} {% if warn %} {% else %} {% endif %}
    {% if p.children().count > 0 %} {% endif %}
  • {% endfor %} {% endmacro %} {% import _self as macro %} {% if admin.route %} {% set context = admin.page(true) %} {# {% if admin.language != admin.session.admin_lang %} {% do admin.setMessage('Session language does not match') %} {% endif %} #} {% elseif grav.language.enabled and admin.language != admin.session.admin_lang %} {# Redirect to last set language #} {% do admin.redirect(admin.adminRoute('/pages', admin.session.admin_lang)) %} {% endif %} {% if uri.param('new') %} {% set mode = 'new' %} {% elseif context %} {% set mode = 'edit' %} {% if context.exists %} {% set page_url = admin_route('/pages' ~ (context.header.routes.default ?: context.rawRoute)) %} {% set exists = true %} {% set title = (context.exists ? "PLUGIN_ADMIN.EDIT"|tu : "PLUGIN_ADMIN.CREATE"|tu ) ~ " " ~ (context.header.title ?: context.title) %} {% else %} {% set title = "PLUGIN_ADMIN.ADD_PAGE"|tu %} {% endif %} {% else %} {% set mode = 'list' %} {% set title = "PLUGIN_ADMIN.PAGES"|tu %} {% endif %} {% set modular = context.isModule ? 'modular_' : '' %} {% set warn = config.plugins.admin.warnings.delete_page %} {% set secure_delete = config.plugins.admin.warnings.secure_delete %} {% set page_lang = context.language %} {% set type = 'page' %} {% block stylesheets %} {% if mode == 'edit' %} {% do assets.addCss(theme_url~'/css/codemirror/codemirror.css') %} {% endif %} {{ parent() }} {% endblock %} {% block javascripts %} {{ parent() }} {% endblock %} {% if config.plugins.admin.frontend_preview_target != 'inline' %} {% set preview_route = (base_url_relative_frontend|rtrim('/') ~ (context.home ? '' : context.route)) ?: '/' %} {% set preview_target = config.plugins.admin.frontend_preview_target %} {% set preview_link = context.routable ? ' ' : '' %} {% else %} {% set preview_route = admin_route('/preview' ~ (context.home ? '' : context.route)) %} {% set preview_link = context.routable ? ' ' : '' %} {% endif %} {% block titlebar %}
    {% if mode == 'list' %} {{ "PLUGIN_ADMIN.BACK"|tu }} {% for key, add_modal in config.plugins.admin.add_modals %} {% if add_modal.show_in|defined('bar') == 'bar' %} {{ add_modal.label|tu }} {% endif %} {% endfor %}
    {% if admin.multilang %}
    {% if admin.languages_enabled|length > 1 %} {% endif %}
    {% endif %} {% elseif mode == 'edit' %} {{ preview_link|raw }} {% if exists %} {% set siblings = context.parent().children() %} {% if not siblings.isFirst(context.path) %} {% set sib = siblings.nextSibling(context.path) %} {% set sib_url = admin_route('/pages' ~ (sib.header.routes.default ?: sib.rawRoute)) %} {% endif %} {% if not siblings.isLast(context.path) %} {% set sib = siblings.prevSibling(context.path) %} {% set sib_url = admin_route('/pages' ~ (sib.header.routes.default ?: sib.rawRoute)) %} {% endif %} {% if warn %} {{ "PLUGIN_ADMIN.DELETE"|tu }} {% else %} {% endif %}
    {{ "PLUGIN_ADMIN.COPY"|tu }} {{ "PLUGIN_ADMIN.MOVE"|tu }} {% if config.plugins['admin-pro'].enabled %} {{ "PLUGIN_ADMIN_PRO.REVISIONS"|tu }} {% endif %} {% endif %}
    {% if exists and admin.multilang %} {% set untranslated = context.untranslatedLanguages(true) %} {% if untranslated %} {% endif %} {% endif %}
    {% endif %}
    {% if mode == 'new' %}

    {{ "PLUGIN_ADMIN.ADD_PAGE"|tu }}

    {% elseif mode == 'edit' %}

    {{ context.title }}

    {% else %}

    {{ "PLUGIN_ADMIN.MANAGE_PAGES"|tu }}

    {% endif %} {% endblock %} {% block content %}
    {% if mode == 'new' %} {% include 'partials/blueprints-new.html.twig' with { blueprints: admin.blueprints('pages/page'), data: context } %} {% elseif mode == 'edit' %}
    {% if admin.multilang %} {% set translated = context.translatedLanguages(false) %}
    {% if exists and translated|length > 1 - (exists and not page_lang)|int %} {% endif %}
    {% endif %} {% if context.blueprints.fields and user.authorize('admin.super') %} {% set normalText = "PLUGIN_ADMIN.NORMAL"|tu %} {% set expertText = "PLUGIN_ADMIN.EXPERT"|tu %} {% set maxLen = max([normalText|length, expertText|length]) %} {% set normalText = macro.spanToggle(normalText, maxLen) %} {% set expertText = macro.spanToggle(expertText, maxLen) %}
    {% endif %}
    {# Set current form data back into page content #} {% if current_form_data %} {% do context.header(current_form_data.header) %} {% do context.content(current_form_data.content) %} {% endif %} {% if (context.blueprints.fields and admin.session.expert == '0') or not user.authorize('admin.super') %} {% include 'partials/blueprints.html.twig' with { blueprints: context.blueprints, data: context } %} {% else %} {% include 'partials/blueprints-raw.html.twig' with { blueprints: admin.blueprints('admin/pages/'~modular~'raw'), data: context } %} {% endif %}
    {% else %}
    {{ "PLUGIN_ADMIN.EXPAND_ALL"|tu }} {{ "PLUGIN_ADMIN.COLLAPSE_ALL"|tu }}
    {% include 'partials/page-legend.html.twig' %}
    {% endif %}
    {% if context %} {% set obj_data = clone(context) %} {% if mode == 'edit' %} {% do obj_data.folder('') %} {% endif %} {% endif %} {% if mode == 'list' or mode == 'edit' %}
    {% include 'partials/blueprints-new.html.twig' with { blueprints: admin.blueprints('admin/pages/new'), data: obj_data, form_id:'new-page' } %}
    {% include 'partials/blueprints-new-folder.html.twig' with { blueprints: admin.blueprints('admin/pages/new_folder'), data: obj_data, form_id:'new-folder' } %}
    {% include 'partials/blueprints-new.html.twig' with { blueprints: admin.blueprints('admin/pages/modular_new'), data: obj_data, form_id:'new-modular' } %}
    {% for key, add_modal in config.plugins.admin.add_modals %}
    {% include add_modal.template|defined('partials/blueprints-new.html.twig') with { blueprints: admin.blueprints(add_modal.blueprint), data: context, form_id:'add-modal' }|merge(add_modal.with|defined({})) %}
    {% endfor %} {% endif %}

    Parents

    Loading...
    {% if mode == 'edit' %}
    {% include 'partials/page-move.html.twig' with { blueprints: admin.blueprints('admin/pages/move'), data: context } %}
    {% include ['partials/page-revisions.html.twig', 'empty.html.twig'] ignore missing with { data: context } %}
    {% endif %} {% include 'partials/modal-changes-detected.html.twig' %}

    {{ "PLUGIN_ADMIN.MODAL_DELETE_PAGE_CONFIRMATION_REQUIRED_TITLE"|tu }}

    {% if context %} {{ "PLUGIN_ADMIN.PAGE"|tu }}: {{ context.title }} {% endif %}

    {{ "PLUGIN_ADMIN.MODAL_DELETE_PAGE_CONFIRMATION_REQUIRED_DESC"|tu }}

    {% if secure_delete %}

    {% endif %}
    {% if secure_delete %} {% else %} {{ "PLUGIN_ADMIN.CONTINUE"|tu }} {% endif %}
    {% include 'partials/admin-pro-pages-addons.html.twig' ignore missing %} {% endblock %} {% block bottom %} {{ parent() }} {% endblock %}