Merge pull request #16344 from mauriciofauth/remove-list-templates

Remove list templates
This commit is contained in:
Maurício Meneghini Fauth 2020-09-13 10:40:55 -03:00 committed by GitHub
commit f3f6bc614e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 49 additions and 127 deletions

View File

@ -91,23 +91,7 @@ class FormDisplayTemplate
*/
public function displayTabsTop(array $tabs): string
{
$items = [];
foreach ($tabs as $tabId => $tabName) {
$items[] = [
'content' => htmlspecialchars($tabName),
'url' => [
'href' => '#' . $tabId,
],
];
}
$htmlOutput = $this->template->render('list/unordered', [
'class' => 'tabs responsivetable row',
'items' => $items,
]);
$htmlOutput .= '<div class="tabs_contents col">';
return $htmlOutput;
return $this->template->render('config/form_display/tabs_top', ['tabs' => $tabs]);
}
/**

View File

@ -109,23 +109,6 @@ class HomeController extends AbstractController
$checkUserPrivileges = new CheckUserPrivileges($this->dbi);
$checkUserPrivileges->getPrivileges();
if (($cfg['Server']['auth_type'] !== 'config') && $cfg['ShowChgPassword']) {
$changePassword = $this->template->render('list/item', [
'content' => Generator::getImage('s_passwd') . ' ' . __(
'Change password'
),
'id' => 'li_change_password',
'class' => 'list-group-item',
'url' => [
'href' => Url::getFromRoute('/user-password'),
'target' => null,
'id' => 'change_password_anchor',
'class' => 'ajax',
],
'mysql_help_page' => null,
]);
}
$charsets = Charsets::getCharsets($this->dbi, $cfg['Server']['DisableIS']);
$collations = Charsets::getCollations($this->dbi, $cfg['Server']['DisableIS']);
$charsetsList = [];
@ -146,21 +129,6 @@ class HomeController extends AbstractController
'collations' => $collationsList,
];
}
$userPreferences = $this->template->render('list/item', [
'content' => Generator::getImage('b_tblops') . ' ' . __(
'More settings'
),
'id' => 'li_user_preferences',
'class' => 'list-group-item',
'url' => [
'href' => Url::getFromRoute('/preferences/manage'),
'target' => null,
'id' => null,
'class' => null,
],
'mysql_help_page' => null,
]);
}
}
@ -217,20 +185,6 @@ class HomeController extends AbstractController
$webServer['php_version'] = PHP_VERSION;
}
}
if ($cfg['ShowPhpInfo']) {
$phpInfo = $this->template->render('list/item', [
'content' => __('Show PHP information'),
'id' => null,
'class' => 'list-group-item',
'url' => [
'href' => Url::getFromRoute('/phpinfo'),
'target' => '_blank',
'id' => null,
'class' => null,
],
'mysql_help_page' => null,
]);
}
$relation = new Relation($this->dbi);
if ($server > 0) {
@ -278,14 +232,13 @@ class HomeController extends AbstractController
'is_demo' => $cfg['DBG']['demo'],
'has_server_selection' => $hasServerSelection ?? false,
'server_selection' => $serverSelection ?? '',
'change_password' => $changePassword ?? '',
'has_change_password_link' => $cfg['Server']['auth_type'] !== 'config' && $cfg['ShowChgPassword'],
'charsets' => $charsetsList ?? [],
'language_selector' => $languageSelector,
'theme_selection' => $themeSelection,
'user_preferences' => $userPreferences ?? '',
'database_server' => $databaseServer,
'web_server' => $webServer,
'php_info' => $phpInfo ?? '',
'show_php_info' => $cfg['ShowPhpInfo'],
'is_version_checked' => $cfg['VersionCheck'],
'phpmyadmin_version' => PMA_VERSION,
'config_storage_message' => $configStorageMessage ?? '',

View File

@ -403,29 +403,7 @@ class Relation
$retval .= '</table>' . "\n";
if (! $cfgRelation['allworks']) {
$retval .= '<p>' . __('Quick steps to set up advanced features:')
. '</p>';
$items = [];
$items[] = sprintf(
__(
'Create the needed tables with the '
. '<code>%screate_tables.sql</code>.'
),
htmlspecialchars(SQL_DIR)
) . ' ' . MySQLDocumentation::showDocumentation('setup', 'linked-tables');
$items[] = __('Create a pma user and give access to these tables.') . ' '
. MySQLDocumentation::showDocumentation('config', 'cfg_Servers_controluser');
$items[] = __(
'Enable advanced features in configuration file '
. '(<code>config.inc.php</code>), for example by '
. 'starting from <code>config.sample.inc.php</code>.'
) . ' ' . MySQLDocumentation::showDocumentation('setup', 'quick-install');
$items[] = __(
'Re-login to phpMyAdmin to load the updated configuration file.'
);
$retval .= $this->template->render('list/unordered', ['items' => $items]);
$retval .= $this->template->render('relation/diagnostic_info', ['sql_dir' => SQL_DIR]);
}
}

View File

@ -0,0 +1,6 @@
<ul class="tabs responsivetable row">
{% for id, name in tabs %}
<li><a href="#{{ id }}">{{ name }}</a></li>
{% endfor %}
</ul>
<div class="tabs_contents col">

View File

@ -40,7 +40,13 @@
{% endif %}
{% if server > 0 %}
{{ change_password is not empty ? change_password|raw }}
{% if has_change_password_link %}
<li id="li_change_password" class="list-group-item">
<a href="{{ url('/user-password') }}" id="change_password_anchor" class="ajax">
{{ get_icon('s_passwd', 'Change password'|trans, true) }}
</a>
</li>
{% endif %}
<li id="li_select_mysql_collation" class="list-group-item">
<form class="disableAjax" method="post" action="{{ url('/collation-connection') }}">
@ -67,8 +73,13 @@
{% endif %}
</form>
</li>
<li id="li_user_preferences" class="list-group-item">
<a href="{{ url('/preferences/manage') }}">
{{ get_icon('b_tblops', 'More settings'|trans, true) }}
</a>
</li>
{% endif %}
{{ user_preferences is not empty ? user_preferences|raw }}
</ul>
</div>
{% endif %}
@ -136,7 +147,7 @@
</div>
{% endif %}
{% if web_server is not empty or php_info is not empty %}
{% if web_server is not empty or show_php_info %}
<div class="card mt-4">
<div class="card-header">
{% trans 'Web server' %}
@ -162,8 +173,12 @@
{{ web_server.php_version }}
</li>
{% endif %}
{% if php_info is not empty %}
{{ php_info|raw }}
{% if show_php_info %}
<li class="list-group-item">
<a href="{{ url('/phpinfo') }}" target="_blank" rel="noopener noreferrer">
{% trans 'Show PHP information' %}
</a>
</li>
{% endif %}
</ul>
</div>

View File

@ -1,19 +0,0 @@
<li{% if id is not empty %} id="{{ id }}"{% endif -%}
{%- if class is not empty %} class="{{ class }}"{% endif %}>
{% if url is defined and url is iterable and url['href'] is not empty %}
<a{% if url['href'] is not empty %} href="{{ url['href']|raw }}"{% endif -%}
{%- if url['target'] is not empty %} target="{{ url['target'] }}"{% endif -%}
{%- if url['target'] is not empty and url['target'] == '_blank' %} rel="noopener noreferrer"{% endif -%}
{%- if url['id'] is not empty %} id="{{ url['id'] }}"{% endif -%}
{%- if url['class'] is not empty %} class="{{ url['class'] }}"{% endif -%}
{%- if url['title'] is not empty %} title="{{ url['title'] }}"{% endif %}>
{% endif %}
{{ content|raw }}
{% if url is defined and url is iterable and url['href'] is not empty %}
</a>
{% endif %}
{% if mysql_help_page is not empty %}
{{ show_mysql_docu(mysql_help_page) }}
{% endif %}
</li>

View File

@ -1,14 +0,0 @@
<ul{% if id is not empty %} id="{{ id }}"{% endif -%}
{%- if class is not empty %} class="{{ class }}"{% endif %}>
{% if items is not empty %}
{% for item in items %}
{% if item is not iterable %}
{% set item = {'content': item} %}
{% endif %}
{% include 'list/item.twig' with item only %}
{% endfor %}
{% elseif content is not empty %}
{{ content|raw }}
{% endif %}
</ul>

View File

@ -0,0 +1,19 @@
<p>{% trans 'Quick steps to set up advanced features:' %}</p>
<ul>
<li>
{{ 'Create the needed tables with the <code>%screate_tables.sql</code>.'|trans|format(sql_dir|e)|raw }}
{{ show_docu('setup', 'linked-tables') }}
</li>
<li>
{% trans 'Create a pma user and give access to these tables.' %}
{{ show_docu('config', 'cfg_Servers_controluser') }}
</li>
<li>
{% trans 'Enable advanced features in configuration file (<code>config.inc.php</code>), for example by starting from <code>config.sample.inc.php</code>.' %}
{{ show_docu('setup', 'quick-install') }}
</li>
<li>
{% trans 'Re-login to phpMyAdmin to load the updated configuration file.' %}
</li>
</ul>