First commit

This commit is contained in:
Flavio Copes 2015-09-13 20:32:44 +02:00
commit b7ce57b541
10 changed files with 273 additions and 0 deletions

View file

@ -0,0 +1,51 @@
{% macro loop(elements) %}
<ul>
{% for key, item in elements %}
{% if item is iterable %}
<li><strong>{{key|e|capitalize}}</strong>:</li>
{{ _self.loop(item) }}
{% else %}
<li><strong>{{key|e|capitalize}}</strong>: {{ item|e }}</li>
{% endif %}
{% endfor %}
</ul>
{% endmacro %}
<h1>
{{ config.plugins['data-manager'].types[type].item.title ?: type|e|capitalize ~ " " ~ "PLUGIN_DATA_MANAGER.ITEM_DETAILS"|e|tu }}
</h1>
<ul>
{% if config.plugins['data-manager'].types[type].item.fields %}
{% for key, type in config.plugins['data-manager'].types[type].item.fields %}
<li class="page-item">
<div class="row">
<strong>{{type.name|e|capitalize}}</strong>:
{% set item = grav.twig.itemData[key]|cast_to_array %}
{% if item is iterable %}
{{ _self.loop(item) }}
{% else %}
{{ item|e }}
{% endif %}
</div>
</li>
{% endfor %}
{% else %}
{% for key, type in grav.twig.itemData %}
<li class="page-item">
<div class="row">
<strong>{{key|capitalize}}</strong>:
{% set item = grav.twig.itemData[key]|cast_to_array %}
{% if item is iterable %}
{{ _self.loop(item) }}
{% else %}
{{ item|e }}
{% endif %}
</div>
</li>
{% endfor %}
{% endif %}
</ul>

View file

@ -0,0 +1,47 @@
<h1>
{{ config.plugins['data-manager'].types[type].list.title ?: type|e|capitalize ~ " " ~ "PLUGIN_DATA_MANAGER.ITEMS_LIST"|e|tu }}
</h1>
<div class="row">
{% if config.plugins['data-manager'].types[type].list.columns %}
<table>
<thead>
<tr>
{% for column in config.plugins['data-manager'].types[type].list.columns %}
<th>{{ column.label|e }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for item in grav.twig.items %}
<tr>
{% for column in config.plugins['data-manager'].types[type].list.columns %}
<td>
<a href="{{ type }}/{{ item.route }}">
{% if column.field is iterable %}
{% set value = item.content %}
{% for field in column.field %}
{% set value = value[field] %}
{% endfor %}
{{ value|e }}
{% else %}
{{ item.content[column.field]|e }}
{% endif %}
</a>
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<ul class="pages-list depth-0">
{% for item in grav.twig.items %}
<li class="page-item">
<div class="row">
<a href="{{ type }}/{{ item.route }}" class="page-edit">{{ item.route|e }}</a>
</div>
</li>
{% endfor %}
</ul>
{% endif %}
</div>

View file

@ -0,0 +1,17 @@
<div class="gpm gpm-themes">
<h1>
{{"PLUGIN_DATA_MANAGER.DATA_TYPES"|e|tu}}
</h1>
<div class="gpm gpm-themes themes card-row grid fixed-blocks pure-g">
{% for type, count in grav.twig.types %}
<a href="data-manager/{{ type }}" class="pure-u-1-3 card-item">
<div class="theme">
<div class="gpm-name">
{{ config.plugins['data-manager'].types[type].name|e ?: type|capitalize|e }}
</div>
<p>{{ count }} {{"PLUGIN_DATA_MANAGER.ITEMS"|e|tu}}</p>
</div>
</a>
{% endfor %}
</div>
</div>