Use template for getHtmlForShowAll method
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
This commit is contained in:
parent
46a6d98d3d
commit
1a4d65a58c
@ -285,16 +285,11 @@ class BrowseForeigners
|
||||
*/
|
||||
public static function getHtmlForShowAll($showAll, $maxRows, $foreignData)
|
||||
{
|
||||
$return = '';
|
||||
if (is_array($foreignData['disp_row'])) {
|
||||
if ($showAll && ($foreignData['the_total'] > $maxRows)) {
|
||||
$return = '<input type="submit" id="foreign_showAll" '
|
||||
. 'name="foreign_showAll" '
|
||||
. 'value="' . __('Show all') . '" />';
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
return Template::get('table/browse_foreigners/show_all')->render([
|
||||
'foreign_data' => $foreignData,
|
||||
'show_all' => $showAll,
|
||||
'max_rows' => $maxRows,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
5
templates/table/browse_foreigners/show_all.twig
Normal file
5
templates/table/browse_foreigners/show_all.twig
Normal file
@ -0,0 +1,5 @@
|
||||
{% if foreign_data.disp_row is iterable and
|
||||
(show_all and foreign_data.the_total > max_rows) %}
|
||||
<input type="submit" id="foreign_showAll" name="foreign_showAll" value="
|
||||
{%- trans 'Show all' %}">
|
||||
{% endif %}
|
||||
@ -125,10 +125,10 @@ class BrowseForeignersTest extends TestCase
|
||||
|
||||
$foreignData['the_total'] = 30;
|
||||
|
||||
$this->assertEquals(
|
||||
$this->assertContains(
|
||||
'<input type="submit" id="foreign_showAll" '
|
||||
. 'name="foreign_showAll" '
|
||||
. 'value="' . 'Show all' . '" />',
|
||||
. 'value="' . 'Show all' . '">',
|
||||
BrowseForeigners::getHtmlForShowAll(
|
||||
$GLOBALS['cfg']['ShowAll'],
|
||||
$GLOBALS['cfg']['MaxRows'],
|
||||
|
||||
Loading…
Reference in New Issue
Block a user