engelsystem/resources/views/pages/settings/api.twig

111 lines
4.0 KiB
Twig
Raw Normal View History

2023-11-16 18:20:50 +01:00
{% extends 'pages/settings/settings.twig' %}
{% import 'macros/form.twig' as f %}
{% block title %}{{ __('settings.api') }}{% endblock %}
{% block row_content %}
<div content="row">
<div class="col-md-12">
{{ f.button(
__('settings.api.key_show'),
{'size': 'sm', 'icon_left': 'key', 'attr': {
'data-bs-toggle': 'collapse', 'data-bs-target': '#key_hide',
'aria-expanded': 'true', 'aria-controls': 'key_hide'
}}
) }}
{% if can('shifts_json_export') %}
2023-11-16 18:20:50 +01:00
{{ f.button(
__('settings.api.shifts_json_show'),
{'size': 'sm', 'icon_left': 'braces', 'attr': {
'data-bs-toggle': 'collapse', 'data-bs-target': '#shifts_json_hide',
'aria-expanded': 'true', 'aria-controls': 'shifts_json_hide'
}}
) }}
{% endif %}
{% if can('ical') %}
2023-11-16 18:20:50 +01:00
{{ f.button(
__('settings.api.ical_show'),
{'size': 'sm', 'icon_left': 'calendar-week', 'attr': {
'data-bs-toggle': 'collapse', 'data-bs-target': '#ical_hide',
'aria-expanded': 'true', 'aria-controls': 'ical_hide'
}}
) }}
{% endif %}
{% if can('atom') %}
2023-11-16 18:20:50 +01:00
{{ f.button(
__('settings.api.news_show'),
{'size': 'sm', 'icon_left': 'calendar-week', 'attr': {
'data-bs-toggle': 'collapse', 'data-bs-target': '#news_hide',
'aria-expanded': 'true', 'aria-controls': 'news_hide'
}}
) }}
{% endif %}
<form method="post" class="d-inline">
{{ csrf() }}
{{ f.submit(
__('settings.api.key_reset'),
2024-04-07 19:27:46 +02:00
{
'size': 'sm', 'btn_type': 'danger',
'icon_left': 'arrow-repeat', 'confirm_text': __('settings.api.key_reset_confirm')
}
2023-11-16 18:20:50 +01:00
) }}
</form>
</div>
<div class="col-md-12 pt-2" id="exports_hide">
<p id="key_hide" class="collapse" data-bs-parent="#exports_hide">
<code>{{ user.api_key }}</code>
</p>
{% if can('shifts_json_export') %}
2023-11-16 18:20:50 +01:00
<p id="shifts_json_hide" class="collapse" data-bs-parent="#exports_hide">
<code>{{ url('/shifts-json-export', {'key': user.api_key}) }}</code>
</p>
{% endif %}
{% if can('ical') %}
2023-11-16 18:20:50 +01:00
<p id="ical_hide" class="collapse" data-bs-parent="#exports_hide">
<code>{{ url('/ical', {'key': user.api_key}) }}</code>
</p>
{% endif %}
{% if can('atom') %}
2023-11-16 18:20:50 +01:00
<p id="news_hide" class="collapse" data-bs-parent="#exports_hide">
<code>{{ url('/atom', {'key': user.api_key}) }}</code>
{% if can('user_meetings') %}
2024-04-07 19:27:46 +02:00
<br><code>{{ url('/atom', {'meetings': 1, 'key': user.api_key}) }}</code>
{% endif %}
<br><code>{{ url('/rss', {'key': user.api_key}) }}</code>
{% if can('user_meetings') %}
2024-04-07 19:27:46 +02:00
<br><code>{{ url('/rss', {'meetings': 1, 'key': user.api_key}) }}</code>
{% endif %}
2023-11-16 18:20:50 +01:00
</p>
{% endif %}
</div>
</div>
<div class="row">
<div class="col-md-12">
{% if can('api') %}
2024-04-07 19:27:46 +02:00
{{ __('settings.api.about', [
config('app_name'),
url('/api/v0-beta'),
url('/api/v0-beta/openapi')
])|markdown|nl2br }}
{% endif %}
{{ __('settings.api.about.warning')|markdown|nl2br }}
2023-11-16 18:20:50 +01:00
</div>
</div>
{% endblock %}