Refactor db search templates

Signed-off-by: Leonardo Strozzi <laps15@inf.ufpr.br>
This commit is contained in:
Leonardo Strozzi 2018-06-18 21:55:18 -03:00
parent 3516f4d410
commit 99506813b6
5 changed files with 23 additions and 36 deletions

View File

@ -68,10 +68,4 @@ if ($response->isAjax() && empty($_REQUEST['ajax_page_request'])) {
}
// Display the search form
$response->addHTML($db_search->getSelectionForm());
$response->addHTML('<div id="searchresults"></div>');
$response->addHTML(
'<div id="togglesearchresultsdiv"><a id="togglesearchresultlink"></a></div>'
);
$response->addHTML('<br class="clearfloat" />');
$response->addHTML($db_search->getResultDivs());
$response->addHTML($db_search->getMainHtml());

View File

@ -317,7 +317,7 @@ class Search
*
* @return string HTML for selection form
*/
public function getSelectionForm()
public function getMainHtml()
{
$choices = [
'1' => $this->searchTypes[1] . ' '
@ -332,7 +332,7 @@ class Search
'4' => $this->searchTypes[4],
'5' => $this->searchTypes[5] . ' ' . Util::showMySQLDocu('Regexp')
];
return $this->template->render('database/search/selection_form', [
return $this->template->render('database/search/main', [
'db' => $this->db,
'choices' => $choices,
'criteria_search_string' => $this->criteriaSearchString,
@ -343,14 +343,4 @@ class Search
? $this->criteriaColumnName : null,
]);
}
/**
* Provides div tags for browsing search results and sql query form.
*
* @return string div tags
*/
public function getResultDivs()
{
return $this->template->render('database/search/result_divs');
}
}

View File

@ -61,3 +61,19 @@
<div id="togglesearchformdiv">
<a id="togglesearchformlink"></a>
</div>
<div id="searchresults"></div>
<div id="togglesearchresultsdiv"><a id="togglesearchresultlink"></a></div>
<br class="clearfloat" />
{# These two table-image and table-link elements display the table name in browse search results #}
<div id="table-info">
<a id="table-link" class="item"></a>
</div>
{# Div for browsing results #}
<div id="browse-results">
{# This browse-results div is used to load the browse and delete results in the db search #}
</div>
<div id="sqlqueryform" class="clearfloat">
{# This sqlqueryform div is used to load the delete form in the db search #}
</div>
{# Toggle query box link #}
<a id="togglequerybox"></a>

View File

@ -1,13 +0,0 @@
{# These two table-image and table-link elements display the table name in browse search results #}
<div id="table-info">
<a id="table-link" class="item"></a>
</div>
{# Div for browsing results #}
<div id="browse-results">
{# This browse-results div is used to load the browse and delete results in the db search #}
</div>
<div id="sqlqueryform" class="clearfloat">
{# This sqlqueryform div is used to load the delete form in the db search #}
</div>
{# Toggle query box link #}
<a id="togglequerybox"></a>

View File

@ -1,9 +1,9 @@
<table class="data">
<caption class="tblHeaders">
{{ 'Search results for "<em>%s</em>" %s:'|format(
{{ 'Search results for "<em>%s</em>" %s:' | format(
criteria_search_string,
search_type_description
)|raw }}
) | raw }}
</caption>
{% for row in rows %}
<tr class="noclick">
@ -15,7 +15,7 @@
%1$s matches in <strong>%2$s</strong>
{% endtrans %}
{% endset %}
{{ result_message|format(row.result_count, row.table)|raw }}
{{ result_message | format(row.result_count, row.table) | raw }}
</td>
{% if row.result_count > 0 %}
{% set url_params = {
@ -51,7 +51,7 @@
{% endfor %}
</table>
{% if criteria_tables|length > 1 %}
{% if criteria_tables | length > 1 %}
<p>
{% trans %}
<strong>Total:</strong> <em>{{ count }}</em> match