mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-05-06 09:07:22 +02:00
163 lines
5.5 KiB
Twig
163 lines
5.5 KiB
Twig
{% extends 'partials/base.html.twig' %}
|
|
|
|
{% macro loop(page, base_url) %}
|
|
{% set orderby = page.orderBy() %}
|
|
{% if orderby != 'default' %}
|
|
<li class="notice">Sub-pages ordered by: <strong>{{ orderby|capitalize }}</strong></li>
|
|
{% endif %}
|
|
{% for p in page.children %}
|
|
{% if orderby == 'default' %}
|
|
<li class="dd-item" data-id="{{ p.route }}">
|
|
<div class="dd-handle">
|
|
{# <span class="">
|
|
<i class="fa fa-bars fa-fixed-width"></i>
|
|
</span> #}
|
|
<i class="fa {{ p.visible ? 'fa-check-square-o' : (not p.page ? 'fa-folder-open-o' : (p.routable ? 'fa-square-o' : 'fa-shield')) }}"></i>
|
|
{{ p.menu }} {{ p.modular() ? '(Modular)' }}
|
|
<span class="dd-nodrag home">{{ p.home ? '<i class="fa fa-home"></i>' }}</span>
|
|
<span class="dd-nodrag edit"><a href="{{ base_url }}/pages/{{ p.route|trim('/') }}"><i class="fa fa-edit"></i></a></span>
|
|
<span class="dd-nodrag delete"><a href="{{ base_url }}/pages/{{ p.route|trim('/') }}/task:delete"><i class="fa fa-trash-o"></i></a></span>
|
|
</div>
|
|
{% if p.children.count > 0 and not p.modular() %}
|
|
<ol class="dd-list">
|
|
{{ _self.loop(p, base_url) }}
|
|
</ol>
|
|
{% endif %}
|
|
</li>
|
|
{% else %}
|
|
<li class="dd-item">
|
|
<div class="row">
|
|
<i class="fa {{ p.visible ? 'fa-check-square-o' : (not p.page ? 'fa-folder-open-o' : (p.routable ? 'fa-square-o' : 'fa-shield')) }}"></i>
|
|
{{ p.menu }} {{ p.modular() ? '(Modular)' }}
|
|
<span class="dd-nodrag home">{{ p.home ? '<i class="fa fa-home"></i>' }}</span>
|
|
<span class="edit"><a href="{{ base_url }}/pages/{{ p.route|trim('/') }}"><i class="fa fa-edit"></i></a></span>
|
|
<span class="delete"><a href="{{ base_url }}/pages/{{ p.route|trim('/') }}/task:delete"><i class="fa fa-trash-o"></i></a></span>
|
|
</div>
|
|
{% if p.children.count > 0 and not p.modular() %}
|
|
<ol class="dd-list">
|
|
{{ _self.loop(p, base_url) }}
|
|
</ol>
|
|
{% endif %}
|
|
</li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endmacro %}
|
|
|
|
|
|
{% if admin.route %}
|
|
{% set context = admin.page(true) %}
|
|
{% endif %}
|
|
|
|
{% block stylesheets %}
|
|
{{ parent() }}
|
|
<style>
|
|
[data-grav-remfield], [data-grav-addfield]{
|
|
cursor: pointer;
|
|
}
|
|
|
|
.dd {
|
|
float: none;
|
|
}
|
|
|
|
textarea {
|
|
min-width: 180px;
|
|
min-height: 100px;
|
|
}
|
|
|
|
ul, ol {
|
|
margin: 0;
|
|
padding: 0;
|
|
list-style: none;
|
|
}
|
|
|
|
ol > li:first-child {
|
|
margin-top: 5px;
|
|
}
|
|
|
|
ol > li {
|
|
margin-bottom: 5px;
|
|
}
|
|
|
|
ol .label {
|
|
min-width: 60px;
|
|
display: inline-block;
|
|
vertical-align: top;
|
|
}
|
|
|
|
.dd3-content {padding-left: 0;}
|
|
.dd-handle ~ .dd3-content {padding-left: 40px;}
|
|
|
|
.dd-list {clear: both;}
|
|
.dd3-content, .dd3-handle { height: auto; }
|
|
.dd-grav-actions {position: absolute; right: 5px; z-index: 2;}
|
|
.dd-handle, .dd3-handle { bottom: 0; cursor: move;}
|
|
.dd-grav-item {position: relative;padding-left: 22px;}
|
|
.dd-grav-item .dd3-handle {background: transparent; border: 0;}
|
|
.dd-grav-item .dd3-handle:before {color: #b8b8b8;top: 0; padding: 0; width: 15px;}
|
|
</style>
|
|
{% endblock %}
|
|
|
|
|
|
{% block javascript %}
|
|
{{ parent() }}
|
|
<script type="text/javascript" src="{{ theme_url }}/js/jquery.nestable.js"></script>
|
|
<script type="text/javascript" src="{{ theme_url }}/js/dynfields/array.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function()
|
|
{
|
|
$('#nestable').nestable();
|
|
});
|
|
</script>
|
|
{% endblock %}
|
|
|
|
|
|
{% block content %}
|
|
{% include 'partials/messages.html.twig' %}
|
|
|
|
<div class="button-bar">
|
|
{% if not uri.param('new') %}
|
|
<a class="button" href="{{ uri.route(true) }}/new:1">Add page</a>
|
|
{% if context %}
|
|
{% if not uri.param('expert') %}
|
|
<a class="button" href="{{ uri.route(true) }}/expert:1">Normal mode</a>
|
|
{% else %}
|
|
<a class="button" href="{{ uri.route(true) }}">Expert mode</a>
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endif %}
|
|
</div>
|
|
<div class="admin-block clear">
|
|
{% if uri.param('new') %}
|
|
<h1>
|
|
Add page
|
|
</h1>
|
|
|
|
{% include 'partials/messages.html.twig' %}
|
|
{% include 'partials/blueprints-new.html.twig' with { blueprints: admin.blueprints('pages/page'), data: context } %}
|
|
{% elseif context %}
|
|
<h1>
|
|
|
|
{{ context.exists ? "Edit '#{context.menu}'" : "Create '#{context.menu}'" }}
|
|
{{ file.writable ? '' : '<small>Read only</small>' }}
|
|
</h1>
|
|
|
|
{% if not uri.param('expert') %}
|
|
{% include 'partials/blueprints.html.twig' with { blueprints: context.blueprints, data: context } %}
|
|
{% else %}
|
|
{% include 'partials/blueprints-raw.html.twig' with { blueprints: admin.blueprints('pages/page'), data: context } %}
|
|
{% endif %}
|
|
{% else %}
|
|
<h1>Pages</h1>
|
|
<p>You can easily modify the order of page items by dragging-and-dropping the page items in this list.</p>
|
|
|
|
<div class="dd" id="nestable">
|
|
<ol class="dd-list">
|
|
{{ _self.loop(pages, base_url_relative) }}
|
|
</ol>
|
|
</div>
|
|
|
|
{% endif %}
|
|
</div>
|
|
{% endblock %}
|
|
|