diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index 45d6f671..68249537 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -67,3 +67,7 @@ jobs: - name: PHPStan checks run: | vendor/bin/phpstan analyze --ansi --memory-limit=2G --no-interaction --no-progress + + - name: Twig CS + run: | + vendor/bin/twigcs app/Templates --severity error --display blocking diff --git a/.gitignore b/.gitignore index fc4af1e9..19806e0c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,10 @@ -/.vscode/ /vendor/ -/public/node_modules/ /data/cache/* !/data/cache/.gitkeep /data/logs/*.log /config.inc.php /local.config.inc.php /phinx_local.php -/tests/code-coverage/ /projects/ _site/ .sass-cache/ @@ -15,3 +12,11 @@ _site/ .project .settings/ .idea/ +node_modules/ +public/assets/ +!public/assets/.gitkeep + +# Semantic UI +semantic +!ui/semantic +public/ui/ diff --git a/app/Controllers/Reference.php b/app/Controllers/Reference.php index ea84962f..2fda5728 100644 --- a/app/Controllers/Reference.php +++ b/app/Controllers/Reference.php @@ -12,7 +12,6 @@ class Reference extends ControllerAbstract public function view(Request $req, Response $res, array $args) { $get = $req->getQueryParams(); - // default session param for this controller if (!isset($_SESSION['reference'])) { $_SESSION['reference'] = [ @@ -21,17 +20,6 @@ public function view(Request $req, Response $res, array $args) ]; } - // manage sorting - if (isset($get['orderby'])) { - if ($_SESSION['reference']['orderby'] == $get['orderby']) { - // toggle sort if orderby requested on the same column - $_SESSION['reference']['sort'] = ($_SESSION['reference']['sort'] == "desc" - ? "asc" - : "desc"); - } - $_SESSION['reference']['orderby'] = $get['orderby']; - } - $_SESSION['reference']['pagination'] = 15; $order_field = $_SESSION['reference']['orderby']; $order_sort = $_SESSION['reference']['sort']; @@ -121,7 +109,7 @@ function ($key) use ($join_table) { 'total' => ReferenceModel::query()->where('is_displayed', '=', true)->count(), 'class' => 'reference', 'showmodal' => isset($get['showmodal']), - 'uuid' => isset($get['uuid']) ? $get['uuid'] : '', + 'uuid' => $get['uuid'] ?? '', 'references' => $references, 'orderby' => $_SESSION['reference']['orderby'], 'sort' => $_SESSION['reference']['sort'], @@ -207,8 +195,6 @@ public function register(Request $req, Response $res) public function filter(Request $req, Response $res, array $args) { - $get = $req->getQueryParams(); - // manage sorting if ($args['action'] == 'order') { if (!isset($args['value'])) { diff --git a/app/Controllers/Telemetry.php b/app/Controllers/Telemetry.php index 793cf730..0132d442 100644 --- a/app/Controllers/Telemetry.php +++ b/app/Controllers/Telemetry.php @@ -165,6 +165,7 @@ public function view(Request $request, Response $response) ->toArray(); $dashboard['default_languages'] = json_encode([[ 'type' => 'pie', + 'hole' => .4, 'palette' => 'combo', 'labels' => array_column($languages, 'glpi_default_language'), 'values' => array_column($languages, 'total') diff --git a/app/Templates/default/reference.html.twig b/app/Templates/default/reference.html.twig index 56b65f9d..edf5d213 100644 --- a/app/Templates/default/reference.html.twig +++ b/app/Templates/default/reference.html.twig @@ -1,254 +1,219 @@ {% extends "partials/base.html.twig" %} {% block title %}References{% endblock %} -{% block head %} - {{ parent() }} - - -{% endblock %} {% block header %} -{% set myheader= { - 'title': ' References', - 'text': 'We maintain a public database of registered Galette installations. - You may want register your own!', +{% set myheader = { + 'title': 'References', + 'icon': 'users', + 'text': ' register your instance', } %} {{ parent() }} {% endblock %} {% block content %} -
+
+

- {{total}} users already registered their Galette installations - {% if filters.count is defined and filters.count != total %} ({{ filters.count }} found){% endif %} + {% if filters.count is defined and filters.count != total %} + {{ filters.count }} on {{ total }} registered Galette installations + {% else %} + {{ total }} registered Galette installations + {% endif %}

+
-
-
- -
-
- - -
-
- - +
+
+
+ +
+
+ +
+
+ + +
-
- {{ csrf.field | raw }} + {{ csrf.field|raw }} - - - - - - {% if dyn_refs|length > 0 %} - {% for key, conf in dyn_refs %} - {% if conf.in_list is not defined or conf.in_list == true %} - - {% endif %} +
- {% if orderby == 'name' %}{% endif %} - Name - - {% if orderby == 'country' %}{% endif %} - Country - - {% if orderby == key %}{% endif %} - {{conf.short_label}} -
+ + + + + + + + + + {% for reference in references %} + + + + + + + {% endfor %} - {% endif %} - - - - - - {% for reference in references %} - - - - {% if dyn_refs|length > 0 %} - {% for key, conf in dyn_refs|keys %} - {% if conf.in_list is not defined or conf.in_list == true %} - - {% endif %} - {% endfor %} - {% endif %} - - + {% if references.hasPages() %} + + + + + + {% endif %} +
+ {% if orderby == 'name' %}{% endif %} + Name + + {% if orderby == 'country' %}{% endif %} + Country + + {% if orderby == 'num_members' %}{% endif %} + Members + + {% if orderby == 'created_at' %}{% endif %} + Registration date + + Comment +
+ {% if reference.url %} + {{ reference.name }} + {% else %} + {{ reference.name }} + {% endif %} + + {{ countries_names[reference.country] }} + {{ reference.num_members }}{{ reference.created_at|date("Y-m-d") }} + {{ reference.comment }} +
- {% if orderby == 'created_at' %}{% endif %} - Registration date - - Comment -
- {% if reference.url %} - {{reference.name}} - {% else %} - {{reference.name}} - {% endif %} - - - {{reference[key]}}{{reference.created_at|date("Y-m-d") }} -
- {{reference.comment}} +
+ {% set nearby_pages_limit = 5 %} + {% set current = references.currentPage() %} + +
+ +