Skip to content

Commit 4de7508

Browse files
committed
Merge branch 'release/1.4.0'
2 parents fcca7c3 + 006d145 commit 4de7508

File tree

8 files changed

+92
-19
lines changed

8 files changed

+92
-19
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
.DS_Store
2+
.idea/*
3+
.vscode/*

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# v1.4.0
2+
## 01/08/2022
3+
4+
1. [](#new)
5+
* It is now possible to delete items [#41](https://github.com/getgrav/grav-plugin-data-manager/pull/41), [#42](https://github.com/getgrav/grav-plugin-data-manager/pull/42)
6+
* Allow CVS even with list customization [#35](https://github.com/getgrav/grav-plugin-data-manager/pull/35)
7+
* Mark visited data items to different color [#24](https://github.com/getgrav/grav-plugin-data-manager/pull/24)
8+
2. [](#bugfix)
9+
* Properly store generated CSV files into tmp/cache folder before download, rather than Grav root [#27](https://github.com/getgrav/grav-plugin-data-manager/pull/27)
10+
111
# v1.3.0
212
## 10/08/2021
313

admin/templates/partials/item.html.twig

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,15 @@
1818

1919
{% set data = grav.twig.itemData %}
2020

21-
<h1>
22-
{{ config.plugins['data-manager'].types[type].item.title ?: type|replace({'_': ' '})|capitalize|e ~ " " ~ "PLUGIN_DATA_MANAGER.ITEM_DETAILS"|e|tu|raw }}
23-
</h1>
21+
<div>
22+
<a href="{{ item }}?delete" class="pull-right error-reverse">
23+
<i class="fa fa-lg fa-pull-left fa-trash"></i>
24+
</a>
25+
<h1>
26+
{{ config.plugins['data-manager'].types[type].name ?: type|replace({'_': ' '})|capitalize|e ~ " " ~ "PLUGIN_DATA_MANAGER.ITEM_DETAILS"|e|tu|raw }}
27+
</h1>
28+
</div>
29+
2430
<ul>
2531
{% if data['_data_type'] == 'form' %}
2632
<div>Form submitted: {{ data.timestamp|date('m/d/Y \\a\\t g:m:i A') }}</div><br>

admin/templates/partials/items.html.twig

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1+
{% block stylesheets %}
2+
{% do assets.addInlineCss('a.page-edit:visited { color: #77559D }') %}
3+
{% endblock %}
4+
15
<h1>
2-
{{ config.plugins['data-manager'].types[type].list.title ?: type|capitalize|e ~ " " ~ "PLUGIN_DATA_MANAGER.ITEMS_LIST"|e|tu|raw }}
6+
{{ config.plugins['data-manager'].types[type].list.title|t ?: type|capitalize|e ~ " " ~ "PLUGIN_DATA_MANAGER.ITEMS_LIST"|e|tu|raw }}
37
</h1>
48
<div class="">
59
{% if config.plugins['data-manager'].types[type].list.columns %}
610
<table>
711
<thead>
812
<tr>
913
{% for column in config.plugins['data-manager'].types[type].list.columns %}
10-
<th>{{ column.label|e }}</th>
14+
<th>{{ column.label|e|t }}</th>
1115
{% endfor %}
1216
</tr>
1317
</thead>
@@ -29,20 +33,34 @@
2933
</a>
3034
</td>
3135
{% endfor %}
36+
<td class="right">
37+
<a href="{{ type }}/{{ item.route }}?delete" class="error-reverse">
38+
<i class="fa fa-trash"></i>
39+
</a>
40+
</td>
3241
</tr>
3342
{% endfor %}
3443
</tbody>
3544
</table>
3645
{% else %}
37-
<ul class="">
46+
<table class="table">
47+
<tbody>
3848
{% for item in grav.twig.items %}
39-
<li class="">
40-
<a href="{{ type }}/{{ item.route }}" class="page-edit">{{ item.name|e }}</a>
41-
</li>
49+
<tr>
50+
<td>
51+
<a href="{{ type }}/{{ item.route }}" class="page-edit">{{ item.name|e }}</a>
52+
</td>
53+
<td class="right">
54+
<a href="{{ type }}/{{ item.route }}?delete" class="error-reverse">
55+
<i class="fa fa-trash"></i>
56+
</a>
57+
</td>
58+
</tr>
4259
{% endfor %}
43-
</ul>
44-
<div class="button-bar danger">
45-
<a href="{{ type }}.csv" class="button">Download as CSV</a>
46-
</div>
60+
</tbody>
61+
</table>
4762
{% endif %}
63+
<div class="button-bar danger">
64+
<a href="{{ type }}.csv" class="button">{{ "PLUGIN_DATA_MANAGER.DOWNLOAD_AS"|t }} CSV</a>
65+
</div>
4866
</div>

admin/templates/partials/types.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<a href="data-manager/{{ type }}" class="pure-u-1-3 card-item">
88
<div class="theme">
99
<div class="gpm-name">
10-
{{ config.plugins['data-manager'].types[type].name|e ?: type|capitalize|e }}
10+
{{ config.plugins['data-manager'].types[type].name|e|t ?: type|capitalize|e }}
1111
</div>
1212
<p>{{ count }} {{ "PLUGIN_DATA_MANAGER.ITEMS"|e|tu|raw }}</p>
1313
</div>

blueprints.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Data Manager
2-
version: 1.3.0
2+
version: 1.4.0
33
description: Adds an administration panel to visualize the data
44
icon: database
55
author:

data-manager.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,21 @@ public function onPagesInitialized()
8282
}
8383

8484
if ($file && !$csv) {
85+
// handle delete
86+
if ($uri->query('delete') !== null) {
87+
$fileObj = new \Grav\Framework\File\File(
88+
sprintf('%s/%s/%s', $path, $type, $filename)
89+
);
90+
91+
if ($fileObj) {
92+
$paths = $uri->paths();
93+
array_pop($paths);
94+
95+
$fileObj->delete();
96+
$this->grav->redirect(implode($paths, '/'), 301);
97+
}
98+
}
99+
85100
// Individual data entry.
86101
$twig->itemData = $this->getFileContent($type, $filename, $path);
87102
} elseif ($type) {
@@ -233,9 +248,7 @@ protected function downloadCSV(array $data)
233248
$tmp_file = uniqid() . '.csv';
234249
$tmp = $tmp_dir . '/data-manager/' . basename($tmp_file);
235250

236-
Folder::create(dirname($tmp));
237-
238-
$csv_file = File::instance($tmp_file);
251+
$csv_file = File::instance($tmp . '/', $tmp_file);
239252
$csv_file->save($csv_data);
240253
Utils::download($csv_file->filename(), true);
241254
exit;

languages.yaml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ en:
55
ITEMS_LIST: Items List
66
ITEMS: Items
77
ITEM_DETAILS: Item Details
8+
DOWNLOAD_AS: Download as
89

910
fr:
1011
PLUGIN_DATA_MANAGER:
@@ -21,7 +22,14 @@ da:
2122
ITEMS_LIST: Liste over filer
2223
ITEMS: Filer
2324
ITEM_DETAILS: Detaljer om fil
24-
25+
ru:
26+
PLUGIN_DATA_MANAGER:
27+
DATA_MANAGER: Менеджер данных
28+
DATA_TYPES: Типы данных
29+
ITEMS_LIST: Список элементов
30+
ITEMS: Элементы
31+
ITEM_DETAILS: Подробнее о элементе
32+
2533
de:
2634
PLUGIN_DATA_MANAGER:
2735
DATA_MANAGER: Datenmanager
@@ -37,3 +45,19 @@ ro:
3745
ITEMS_LIST: Lista de elemente
3846
ITEMS: Elemente
3947
ITEM_DETAILS: Detaliile elementelor
48+
49+
zh:
50+
PLUGIN_DATA_MANAGER:
51+
DATA_MANAGER: 数据管理
52+
DATA_TYPES: 数据类型
53+
ITEMS_LIST: 条目列表
54+
ITEMS: 条目
55+
ITEM_DETAILS: 条目详情
56+
57+
el:
58+
PLUGIN_DATA_MANAGER:
59+
DATA_MANAGER: Διαχείριση δεδομένων
60+
DATA_TYPES: Τύποι δεδομένων
61+
ITEMS_LIST: Λίστα στοιχείων
62+
ITEMS: Στοιχεία
63+
ITEM_DETAILS: Λεπτομέρειες στοιχείου

0 commit comments

Comments
 (0)