From d3efa4226ab826abc1bb3773d1fd59dc60881375 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Fri, 26 Aug 2016 14:32:11 -0600 Subject: [PATCH] unified JSON twig templates --- pages/admin/ajax.md | 1 + pages/admin/backup.md | 2 +- pages/admin/cache.md | 1 + pages/admin/media.md | 1 + pages/admin/notifications.md | 1 + pages/admin/pages-filter.md | 1 + pages/admin/update.md | 1 + themes/grav/templates/cache.json.twig | 5 - .../{ajax.json.twig => default.json.twig} | 0 themes/grav/templates/media.json.twig | 5 - themes/grav/templates/notifications.json.twig | 5 - themes/grav/templates/pages-filter.json.twig | 5 - themes/grav/templates/partials/base.html.twig | 140 +++++++++--------- themes/grav/templates/plugins.json.twig | 5 - themes/grav/templates/themes.json.twig | 5 - themes/grav/templates/update.json.twig | 5 - 16 files changed, 78 insertions(+), 105 deletions(-) delete mode 100644 themes/grav/templates/cache.json.twig rename themes/grav/templates/{ajax.json.twig => default.json.twig} (100%) delete mode 100644 themes/grav/templates/media.json.twig delete mode 100644 themes/grav/templates/notifications.json.twig delete mode 100644 themes/grav/templates/pages-filter.json.twig delete mode 100644 themes/grav/templates/plugins.json.twig delete mode 100644 themes/grav/templates/themes.json.twig delete mode 100644 themes/grav/templates/update.json.twig diff --git a/pages/admin/ajax.md b/pages/admin/ajax.md index ef8b0fd0..0692fd8c 100644 --- a/pages/admin/ajax.md +++ b/pages/admin/ajax.md @@ -1,5 +1,6 @@ --- title: Generic Ajax +template: default access: admin.login: true diff --git a/pages/admin/backup.md b/pages/admin/backup.md index 37a26a4e..0e092d7a 100644 --- a/pages/admin/backup.md +++ b/pages/admin/backup.md @@ -1,6 +1,6 @@ --- title: Backup -template: ajax +template: default access: admin.maintenance: true diff --git a/pages/admin/cache.md b/pages/admin/cache.md index fc2ca498..af7f42bd 100644 --- a/pages/admin/cache.md +++ b/pages/admin/cache.md @@ -1,5 +1,6 @@ --- title: Cache +template: default access: admin.cache: true diff --git a/pages/admin/media.md b/pages/admin/media.md index c0e358b8..e3c11183 100644 --- a/pages/admin/media.md +++ b/pages/admin/media.md @@ -1,5 +1,6 @@ --- title: Media +template: default access: admin.pages: true diff --git a/pages/admin/notifications.md b/pages/admin/notifications.md index ce1f6f41..df8aff43 100644 --- a/pages/admin/notifications.md +++ b/pages/admin/notifications.md @@ -1,5 +1,6 @@ --- title: Notifications +template: default access: admin.login: true diff --git a/pages/admin/pages-filter.md b/pages/admin/pages-filter.md index 7a7463e1..f196f0df 100644 --- a/pages/admin/pages-filter.md +++ b/pages/admin/pages-filter.md @@ -1,5 +1,6 @@ --- title: Pages Filter +template: default access: admin.pages: true diff --git a/pages/admin/update.md b/pages/admin/update.md index b5437c46..caad79ba 100644 --- a/pages/admin/update.md +++ b/pages/admin/update.md @@ -1,5 +1,6 @@ --- title: Cache +template: default access: admin.maintenance: true diff --git a/themes/grav/templates/cache.json.twig b/themes/grav/templates/cache.json.twig deleted file mode 100644 index b98dabca..00000000 --- a/themes/grav/templates/cache.json.twig +++ /dev/null @@ -1,5 +0,0 @@ -{% if admin.json_response %} -{{ admin.json_response|json_encode|raw }} -{% else %} -{} -{% endif %} diff --git a/themes/grav/templates/ajax.json.twig b/themes/grav/templates/default.json.twig similarity index 100% rename from themes/grav/templates/ajax.json.twig rename to themes/grav/templates/default.json.twig diff --git a/themes/grav/templates/media.json.twig b/themes/grav/templates/media.json.twig deleted file mode 100644 index b98dabca..00000000 --- a/themes/grav/templates/media.json.twig +++ /dev/null @@ -1,5 +0,0 @@ -{% if admin.json_response %} -{{ admin.json_response|json_encode|raw }} -{% else %} -{} -{% endif %} diff --git a/themes/grav/templates/notifications.json.twig b/themes/grav/templates/notifications.json.twig deleted file mode 100644 index 3572f752..00000000 --- a/themes/grav/templates/notifications.json.twig +++ /dev/null @@ -1,5 +0,0 @@ -{% if admin.json_response %} -{{ admin.json_response|json_encode|raw }} -{% else %} -[] -{% endif %} diff --git a/themes/grav/templates/pages-filter.json.twig b/themes/grav/templates/pages-filter.json.twig deleted file mode 100644 index b98dabca..00000000 --- a/themes/grav/templates/pages-filter.json.twig +++ /dev/null @@ -1,5 +0,0 @@ -{% if admin.json_response %} -{{ admin.json_response|json_encode|raw }} -{% else %} -{} -{% endif %} diff --git a/themes/grav/templates/partials/base.html.twig b/themes/grav/templates/partials/base.html.twig index a606dd18..6b072465 100644 --- a/themes/grav/templates/partials/base.html.twig +++ b/themes/grav/templates/partials/base.html.twig @@ -1,76 +1,78 @@ - - - -{% block head %} - - {% if title %}{{ title }} | {% else %}{% if header.title %}{{ header.title }} | {% endif %}{% endif %}{{ site.title }} - {% if header.description %} - - {% else %} - - {% endif %} - {% if header.robots %} - - {% else %} - - {% endif %} - - +{% if uri.extension() == 'json' %}{% include 'default.json.twig' %}{% else %} + + + + {% block head %} + + {% if title %}{{ title }} | {% else %}{% if header.title %}{{ header.title }} | {% endif %}{% endif %}{{ site.title }} + {% if header.description %} + + {% else %} + + {% endif %} + {% if header.robots %} + + {% else %} + + {% endif %} + + - {% block stylesheets %} - {% include 'partials/stylesheets.html.twig' %} - {{ assets.css()|raw }} - {% endblock %} - - {% include 'partials/javascript-config.html.twig' %} - {% block javascripts %} - {% include 'partials/javascripts.html.twig' %} - {{ assets.js()|raw }} - {% endblock %} -{% endblock %} - -{% block body %} - - {% block page %} -
- - {% block navigation %} - {% include 'partials/nav.html.twig' %} + {% block stylesheets %} + {% include 'partials/stylesheets.html.twig' %} + {{ assets.css()|raw }} {% endblock %} -
- {% include 'partials/nav-toggle.html.twig' %} -
- {% block titlebar %}{% endblock %} -
+ {% include 'partials/javascript-config.html.twig' %} + {% block javascripts %} + {% include 'partials/javascripts.html.twig' %} + {{ assets.js()|raw }} + {% endblock %} + {% endblock %} + + {% block body %} + + {% block page %} +
-
-
- {% block messages %} - {% include 'partials/messages.html.twig' %} - {% endblock %} + {% block navigation %} + {% include 'partials/nav.html.twig' %} + {% endblock %} - {% block widgets %}{% endblock %} -
- {% block content_top %}{% endblock %} -
- {%- block content %}{% endblock -%} -
- {% if config.plugins.admin.show_github_msg %} - - {% endif %} - {% block content_bottom %}{% endblock %} -
-
- Grav v{{ constant('GRAV_VERSION') }} - Admin v{{ admin_version }} - {{ "PLUGIN_ADMIN.WAS_MADE_WITH"|tu|lower }} {{ "PLUGIN_ADMIN.BY"|tu|lower }} RocketTheme. -
+
+ {% include 'partials/nav-toggle.html.twig' %} +
+ {% block titlebar %}{% endblock %}
-
-
-
-
- {% endblock page %} - -{% endblock body %} - +
+
+ {% block messages %} + {% include 'partials/messages.html.twig' %} + {% endblock %} + + {% block widgets %}{% endblock %} +
+ {% block content_top %}{% endblock %} +
+ {%- block content %}{% endblock -%} +
+ {% if config.plugins.admin.show_github_msg %} + + {% endif %} + {% block content_bottom %}{% endblock %} +
+
+ Grav v{{ constant('GRAV_VERSION') }} - Admin v{{ admin_version }} - {{ "PLUGIN_ADMIN.WAS_MADE_WITH"|tu|lower }} {{ "PLUGIN_ADMIN.BY"|tu|lower }} RocketTheme. +
+
+
+ + +
+ + {% endblock page %} + + {% endblock body %} + +{% endif %} diff --git a/themes/grav/templates/plugins.json.twig b/themes/grav/templates/plugins.json.twig deleted file mode 100644 index b98dabca..00000000 --- a/themes/grav/templates/plugins.json.twig +++ /dev/null @@ -1,5 +0,0 @@ -{% if admin.json_response %} -{{ admin.json_response|json_encode|raw }} -{% else %} -{} -{% endif %} diff --git a/themes/grav/templates/themes.json.twig b/themes/grav/templates/themes.json.twig deleted file mode 100644 index b98dabca..00000000 --- a/themes/grav/templates/themes.json.twig +++ /dev/null @@ -1,5 +0,0 @@ -{% if admin.json_response %} -{{ admin.json_response|json_encode|raw }} -{% else %} -{} -{% endif %} diff --git a/themes/grav/templates/update.json.twig b/themes/grav/templates/update.json.twig deleted file mode 100644 index b98dabca..00000000 --- a/themes/grav/templates/update.json.twig +++ /dev/null @@ -1,5 +0,0 @@ -{% if admin.json_response %} -{{ admin.json_response|json_encode|raw }} -{% else %} -{} -{% endif %}