update templates introduce request helper

This commit is contained in:
envoyr
2022-02-20 18:00:44 +01:00
parent e0540ceb7c
commit e057314795
41 changed files with 41521 additions and 275 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,30 @@
/*!
* Bootstrap v5.1.3 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* Sizzle CSS Selector Engine v2.3.6
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Released under the MIT license
* https://js.foundation/
*
* Date: 2021-02-16
*/
/*!
* jQuery JavaScript Library v3.6.0
* https://jquery.com/
*
* Includes Sizzle.js
* https://sizzlejs.com/
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2021-03-02T17:08Z
*/

View File

@@ -0,0 +1,52 @@
{% macro table(table_options, api_response, action, title = "") %}
<form action="{{ action|default("") }}" method="post" enctype="application/x-www-form-urlencoded" class="form">
{% if title is not empty %}
<h3 class="page-header">
{% if table_options.icon is not empty %}
<i class="{{ table_options.icon }}"></i>
{% endif %}
{{ title }}
</h3>
{% endif %}
<div class="card">
<table class="table table-borderless table-striped mb-0">
<thead>
<tr>
{% for column in table_options.visible_columns %}
<th class="p-3">{{ table_options.columns[column].title }}</th>
{% endfor %}
{% if table_options.actions %}
<th class="p-3 text-end">Actions</th>
{% endif %}
</tr>
</thead>
<tbody>
{% for item in api_response.list %}
<tr>
{% for column in table_options.visible_columns %}
<td class="p-3">{{ item[column] }}</td>
{% endfor %}
{% if table_options.actions %}
<th class="p-3 text-end">
{% for action in table_options.actions %}
{% if action.href is not empty %}
<a href="{{ action.href }}">{% if action.icon is not empty %}<i class="{{ action.icon }}"></i>{% endif %}{{ action.title }}</a>
{% else %}
{% if action.icon is not empty %}<i class="{{ action.icon }}"></i>{% endif %}{{ action.title }}
{% endif %}
{% endfor %}
</th>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
<div class="card-footer">
Pagination...
</div>
</div>
</form>
{% endmacro %}

View File

@@ -0,0 +1,9 @@
{% extends "Froxlor/userarea.html.twig" %}
{% block content %}
{% import "Froxlor/table/table.html.twig" as table %}
{{ table.table(table_options, api_response, '#', table_options.title) }}
{% endblock %}