From ffc21164cab704e987db60e3987dd17adb1a4fdf Mon Sep 17 00:00:00 2001 From: Awilum Date: Thu, 13 Feb 2020 17:13:14 +0300 Subject: [PATCH] feat(admin-plugin): update for API's #349 --- .../api/delivery/{ => entries}/add.html | 2 +- .../api/delivery/{ => entries}/edit.html | 20 ++--- .../system/api/delivery/entries/index.html | 89 +++++++++++++++++++ .../templates/system/api/delivery/index.html | 76 +++------------- .../admin/templates/system/api/index.html | 2 +- 5 files changed, 115 insertions(+), 74 deletions(-) rename site/plugins/admin/templates/system/api/delivery/{ => entries}/add.html (99%) rename site/plugins/admin/templates/system/api/delivery/{ => entries}/edit.html (65%) create mode 100644 site/plugins/admin/templates/system/api/delivery/entries/index.html diff --git a/site/plugins/admin/templates/system/api/delivery/add.html b/site/plugins/admin/templates/system/api/delivery/entries/add.html similarity index 99% rename from site/plugins/admin/templates/system/api/delivery/add.html rename to site/plugins/admin/templates/system/api/delivery/entries/add.html index 6393bb9e..79f7aacf 100644 --- a/site/plugins/admin/templates/system/api/delivery/add.html +++ b/site/plugins/admin/templates/system/api/delivery/entries/add.html @@ -44,4 +44,4 @@ -{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/site/plugins/admin/templates/system/api/delivery/edit.html b/site/plugins/admin/templates/system/api/delivery/entries/edit.html similarity index 65% rename from site/plugins/admin/templates/system/api/delivery/edit.html rename to site/plugins/admin/templates/system/api/delivery/entries/edit.html index 98f8c1a1..67e71734 100644 --- a/site/plugins/admin/templates/system/api/delivery/edit.html +++ b/site/plugins/admin/templates/system/api/delivery/entries/edit.html @@ -4,16 +4,16 @@
{{ csrf() }} - - - - - + + + + +
- + {{ tr('admin_help_text_for_tokens_label') }}
@@ -22,7 +22,7 @@ type="text" id="limit" name="limit_calls" - value="{{ api_token_data.limit_calls }}" + value="{{ token_data.limit_calls }}" class="form-control" required="required" data-parsley-required="true" @@ -33,14 +33,14 @@
- + {{ tr('admin_help_text_for_api_token_icon', {':link': 'fontawesome'})|raw }}
diff --git a/site/plugins/admin/templates/system/api/delivery/entries/index.html b/site/plugins/admin/templates/system/api/delivery/entries/index.html new file mode 100644 index 00000000..b2123a19 --- /dev/null +++ b/site/plugins/admin/templates/system/api/delivery/entries/index.html @@ -0,0 +1,89 @@ +{% extends "plugins/admin/templates/partials/base.html" %} + +{% block content %} + {% if (tokens | length > 0) %} + + + + + + + + + + + {% for key, token in tokens %} + {% set token_file_path = PATH_TOKENS ~ '/delivery/entries/' ~ token.dirname ~ '/' ~ 'token.yaml' %} + {% if filesystem_has(token_file_path) %} + {% set token_data = parser_decode(filesystem_read(token_file_path), 'yaml') %} + {% endif %} + + + + + + + + {% endfor %} + +
+ {{ tr('admin_title') }} + + {{ tr('admin_token') }} + + {{ tr('admin_calls') }} +
+ {{ icon(token_data.icon) }} + + {{ token_data.title }} + {{ token.dirname }}{{ token_data.calls }} + / + {% if (token_data.limit_calls > 0) %}{{ token_data.limit_calls }} + {% else %}∞{% endif %} + + + +
+ {% else %} +
+
+ {{ icon('fas fa-database') }} + {{ icon('fas angle-right') }} + {{ icon('fas fa-truck') }} +

{{ tr('admin_you_have_not_created_any_delvery_entries_api_tokens_yet') }}

+ {{ tr('admin_create_new_delivery_entries_token') }} +
+
+ {% endif %} +{% endblock %} + +{% block tail %} + +{% endblock %} \ No newline at end of file diff --git a/site/plugins/admin/templates/system/api/delivery/index.html b/site/plugins/admin/templates/system/api/delivery/index.html index 57818140..dbcdf291 100644 --- a/site/plugins/admin/templates/system/api/delivery/index.html +++ b/site/plugins/admin/templates/system/api/delivery/index.html @@ -1,61 +1,29 @@ {% extends "plugins/admin/templates/partials/base.html" %} {% block content %} - {% if (tokens | length > 0) %} + {% if (api_list | length > 0) %} - - - {% for key, token in tokens %} - {% set token_file_path = PATH_TOKENS ~ '/' ~ api ~ '/' ~ token.dirname ~ '/' ~ 'token.yaml' %} - {% if filesystem_has(token_file_path) %} - {% set token_data = parser_decode(filesystem_read(token_file_path), 'yaml') %} - {% endif %} + {% for key, api in api_list %} - - - - - {% endfor %} @@ -64,25 +32,9 @@ {% else %}
- {{ icon('fas fa-truck') }} -

{{ tr('admin_you_have_not_created_any_delvery_api_tokens_yet') }}

- {{ tr('admin_create_new_delivery_token') }} + {{ icon('fas fa-network-wired') }} +

{{ tr('admin_you_have_not_created_any_api_tokens_yet') }}

{% endif %} -{% endblock %} - -{% block tail %} - {% endblock %} \ No newline at end of file diff --git a/site/plugins/admin/templates/system/api/index.html b/site/plugins/admin/templates/system/api/index.html index cddbfcfe..937bf2dd 100644 --- a/site/plugins/admin/templates/system/api/index.html +++ b/site/plugins/admin/templates/system/api/index.html @@ -18,7 +18,7 @@ {{ icon('fas fa-truck') }} {% endfor %}
- {{ tr('admin_title') }} - - {{ tr('admin_token') }} - - {{ tr('admin_calls') }} + {{ tr('admin_name') }}
- {{ icon(token_data.icon) }} + + {% if key == 'entries' %} + {{ icon('fas fa-database') }} + {% endif %} + {% if key == 'images' %} + {{ icon('far fa-images') }} + {% endif %} - {{ token_data.title }} - {{ token.dirname }}{{ token_data.calls }} - / - {% if (token_data.limit_calls > 0) %}{{ token_data.limit_calls }} - {% else %}∞{% endif %} - - - + + {{ api }}
- {{ api }} + {{ api }}