Merge recent_favorite_table_no_tables template
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
parent
01de54571f
commit
89619f386b
@ -1,15 +1,19 @@
|
||||
{% for table in tables %}
|
||||
<li class="warp_link">
|
||||
<a
|
||||
class="ajax favorite_table_anchor"
|
||||
href="{{ url('/database/structure/favorite-table', table.remove_parameters) }}"
|
||||
title="{% trans 'Remove from Favorites' %}"
|
||||
data-favtargetn="{{ table.table_parameters.md5 }}"
|
||||
>
|
||||
{{ get_icon('b_favorite') }}
|
||||
</a>
|
||||
<a class="disableAjax" href="{{ url('/table/recent-favorite', table.table_parameters) }}">
|
||||
`{{ table.table_parameters.db }}`.`{{ table.table_parameters.table }}`
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% if tables is empty %}
|
||||
{{ 'There are no favorite tables.'|trans }}
|
||||
{% else %}
|
||||
{% for table in tables %}
|
||||
<li class="warp_link">
|
||||
<a
|
||||
class="ajax favorite_table_anchor"
|
||||
href="{{ url('/database/structure/favorite-table', table.remove_parameters) }}"
|
||||
title="{% trans 'Remove from Favorites' %}"
|
||||
data-favtargetn="{{ table.table_parameters.md5 }}"
|
||||
>
|
||||
{{ get_icon('b_favorite') }}
|
||||
</a>
|
||||
<a class="disableAjax" href="{{ url('/table/recent-favorite', table.table_parameters) }}">
|
||||
`{{ table.table_parameters.db }}`.`{{ table.table_parameters.table }}`
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
@ -1,7 +0,0 @@
|
||||
<li class="warp_link">
|
||||
{% if is_recent %}
|
||||
{% trans 'There are no recent tables.' %}
|
||||
{% else %}
|
||||
{% trans 'There are no favorite tables.' %}
|
||||
{% endif %}
|
||||
</li>
|
||||
@ -1,7 +1,11 @@
|
||||
{% for table in tables %}
|
||||
<li class="warp_link">
|
||||
<a class="disableAjax" href="{{ url('/table/recent-favorite', table) }}">
|
||||
`{{ table.db }}`.`{{ table.table }}`
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% if tables is empty %}
|
||||
{{ 'There are no recent tables.'|trans }}
|
||||
{% else %}
|
||||
{% for table in tables %}
|
||||
<li class="warp_link">
|
||||
<a class="disableAjax" href="{{ url('/table/recent-favorite', table) }}">
|
||||
`{{ table.db }}`.`{{ table.table }}`
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
@ -189,39 +189,33 @@ class RecentFavoriteTables
|
||||
*/
|
||||
public function getHtmlList(): string
|
||||
{
|
||||
if ($this->tables !== []) {
|
||||
if ($this->tableType === TableType::Recent) {
|
||||
$tables = [];
|
||||
foreach ($this->tables as $table) {
|
||||
$tables[] = $table->toArray();
|
||||
}
|
||||
|
||||
return $this->template->render('recent_favorite_table_recent', ['tables' => $tables]);
|
||||
}
|
||||
|
||||
if ($this->tableType === TableType::Recent) {
|
||||
$tables = [];
|
||||
foreach ($this->tables as $table) {
|
||||
$removeParameters = [
|
||||
'db' => $table->db->getName(),
|
||||
'favorite_table' => $table->table->getName(),
|
||||
'ajax_request' => true,
|
||||
'remove_favorite' => true,
|
||||
];
|
||||
$tableParameters = [
|
||||
'db' => $table->db->getName(),
|
||||
'table' => $table->table->getName(),
|
||||
'md5' => md5($table->db . '.' . $table->table),
|
||||
];
|
||||
|
||||
$tables[] = ['remove_parameters' => $removeParameters, 'table_parameters' => $tableParameters];
|
||||
$tables[] = $table->toArray();
|
||||
}
|
||||
|
||||
return $this->template->render('recent_favorite_table_favorite', ['tables' => $tables]);
|
||||
return $this->template->render('recent_favorite_table_recent', ['tables' => $tables]);
|
||||
}
|
||||
|
||||
return $this->template->render('recent_favorite_table_no_tables', [
|
||||
'is_recent' => $this->tableType === TableType::Recent,
|
||||
]);
|
||||
$tables = [];
|
||||
foreach ($this->tables as $table) {
|
||||
$removeParameters = [
|
||||
'db' => $table->db->getName(),
|
||||
'favorite_table' => $table->table->getName(),
|
||||
'ajax_request' => true,
|
||||
'remove_favorite' => true,
|
||||
];
|
||||
$tableParameters = [
|
||||
'db' => $table->db->getName(),
|
||||
'table' => $table->table->getName(),
|
||||
'md5' => md5($table->db . '.' . $table->table),
|
||||
];
|
||||
|
||||
$tables[] = ['remove_parameters' => $removeParameters, 'table_parameters' => $tableParameters];
|
||||
}
|
||||
|
||||
return $this->template->render('recent_favorite_table_favorite', ['tables' => $tables]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user