Fix 1039 Default to config file slug if translation is missing, otherwise use translation also in the tab title, not just in the page heading

This commit is contained in:
Flavio Copes
2017-05-01 19:03:27 +02:00
parent 8a95cfadd8
commit 7ff311b8a1
3 changed files with 7 additions and 6 deletions

View File

@@ -13,7 +13,7 @@
* Fixed an quote error in `en.yaml`
* Resolved z-index issues with mobile nav and pages form elements
* Fixed issue with file picker where the selected file preview would not show
* Default to config file slug if translation is missing, otherwise use translation also in the tab title, not just in the page heading [#1039](https://github.com/getgrav/grav-plugin-admin/issues/1039)
# v1.4.2
## 04/24/2017

View File

@@ -397,7 +397,6 @@ class Admin
$languages = (array)$languages;
}
if ($lookup) {
if (empty($languages) || reset($languages) == null) {
if ($grav['config']->get('system.languages.translations_fallback', true)) {

View File

@@ -3,7 +3,9 @@
{% set config_slug = uri.basename %}
{% set isInfo = (config_slug == 'info') %}
{% set title = "PLUGIN_ADMIN.CONFIGURATION"|tu ~ ": " ~ ("PLUGIN_ADMIN." ~ config_slug|upper)|tu %}
{% set tab_title_string = "PLUGIN_ADMIN." ~ config_slug|upper %}
{% set tab_title = (tab_title_string|tu == tab_title_string ? config_slug|capitalize : tab_title_string|tu) %}
{% set title = "PLUGIN_ADMIN.CONFIGURATION"|tu ~ ": " ~ tab_title %}
{% if not isInfo %}
{% set data = admin.data('config/' ~ config_slug) %}
@@ -23,7 +25,7 @@
<a class="button" href="{{ base_url }}"><i class="fa fa-reply"></i> {{ "PLUGIN_ADMIN.BACK"|tu }}</a>
<button class="button" type="submit" name="task" value="save" form="blueprints"><i class="fa fa-check"></i> {{ "PLUGIN_ADMIN.SAVE"|tu }}</button>
</div>
<h1><i class="fa fa-fw fa-wrench"></i> {{ "PLUGIN_ADMIN.CONFIGURATION"|tu }} - {{ ("PLUGIN_ADMIN." ~ config_slug|upper)|tu }}</h1>
<h1><i class="fa fa-fw fa-wrench"></i> {{ "PLUGIN_ADMIN.CONFIGURATION"|tu }} - {{ tab_title }}</h1>
{% endblock %}
{% block content_top %}
@@ -49,7 +51,8 @@
{% set current_blueprints = admin.data('config/' ~ configuration).blueprints.toArray() %}
{% if configuration != 'system' and configuration != 'site' and not current_blueprints.form.hidden and current_blueprints.form.fields is not empty %}
<a {% if config_slug == configuration %}class="active"{% endif %} href="{{ base_url_relative }}/config/{{configuration}}">
<span>{{ configuration|tu|humanize }}</span>
{% set configuration_string = "PLUGIN_ADMIN." ~ configuration|upper %}
<span>{{ (configuration_string|tu == configuration_string ? configuration|capitalize : configuration_string|tu) }}</span>
</a>
{% endif %}
{% endif %}
@@ -77,4 +80,3 @@
{% endif %}
{% include 'partials/modal-changes-detected.html.twig' %}
{% endblock %}