Use template for _getFootersOptions
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
This commit is contained in:
parent
3a00dc7d0a
commit
3eed95aba0
@ -768,21 +768,9 @@ class Qbe
|
||||
*/
|
||||
private function _getFootersOptions($type)
|
||||
{
|
||||
$html_output = '<div class="floatleft">';
|
||||
$html_output .= (($type == 'row')
|
||||
? __('Add/Delete criteria rows') : __('Add/Delete columns'));
|
||||
$html_output .= ':<select size="1" name="'
|
||||
. (($type == 'row') ? 'criteriaRowAdd' : 'criteriaColumnAdd') . '">';
|
||||
$html_output .= '<option value="-3">-3</option>';
|
||||
$html_output .= '<option value="-2">-2</option>';
|
||||
$html_output .= '<option value="-1">-1</option>';
|
||||
$html_output .= '<option value="0" selected="selected">0</option>';
|
||||
$html_output .= '<option value="1">1</option>';
|
||||
$html_output .= '<option value="2">2</option>';
|
||||
$html_output .= '<option value="3">3</option>';
|
||||
$html_output .= '</select>';
|
||||
$html_output .= '</div>';
|
||||
return $html_output;
|
||||
return Template::get('database/qbe/footer_options')->render([
|
||||
'type' => $type,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -797,7 +785,7 @@ class Qbe
|
||||
$html_output .= $this->_getFootersOptions("column");
|
||||
$html_output .= '<div class="floatleft">';
|
||||
$html_output .= '<input type="submit" name="modify"'
|
||||
. 'value="' . __('Update Query') . '" />';
|
||||
. ' value="' . __('Update Query') . '" />';
|
||||
$html_output .= '</div>';
|
||||
$html_output .= '</fieldset>';
|
||||
return $html_output;
|
||||
|
||||
16
templates/database/qbe/footer_options.twig
Normal file
16
templates/database/qbe/footer_options.twig
Normal file
@ -0,0 +1,16 @@
|
||||
<div class="floatleft">
|
||||
{% if type == 'row' %}
|
||||
{% trans 'Add/Delete criteria rows' %}:
|
||||
{% else %}
|
||||
{% trans 'Add/Delete columns' %}:
|
||||
{% endif %}
|
||||
<select size="1" name="{{ type == 'row' ? 'criteriaRowAdd' : 'criteriaColumnAdd' }}">
|
||||
<option value="-3">-3</option>
|
||||
<option value="-2">-2</option>
|
||||
<option value="-1">-1</option>
|
||||
<option value="0" selected="selected">0</option>
|
||||
<option value="1">1</option>
|
||||
<option value="2">2</option>
|
||||
<option value="3">3</option>
|
||||
</select>
|
||||
</div>
|
||||
@ -206,13 +206,22 @@ class QbeTest extends PmaTestCase
|
||||
*/
|
||||
public function testGetFootersOptions()
|
||||
{
|
||||
$this->assertEquals(
|
||||
'<div class="floatleft">Add/Delete criteria rows:<select size="1" '
|
||||
. 'name="criteriaRowAdd"><option value="-3">-3</option><option '
|
||||
. 'value="-2">-2</option><option value="-1">-1</option><option '
|
||||
. 'value="0" selected="selected">0</option><option value="1">1'
|
||||
. '</option><option value="2">2</option><option value="3">3</option>'
|
||||
. '</select></div>',
|
||||
$this->assertContains(
|
||||
'Add/Delete criteria rows',
|
||||
$this->_callProtectedFunction(
|
||||
'_getFootersOptions',
|
||||
array('row')
|
||||
)
|
||||
);
|
||||
$this->assertContains(
|
||||
'name="criteriaRowAdd"',
|
||||
$this->_callProtectedFunction(
|
||||
'_getFootersOptions',
|
||||
array('row')
|
||||
)
|
||||
);
|
||||
$this->assertContains(
|
||||
'<option value="0" selected="selected">0</option>',
|
||||
$this->_callProtectedFunction(
|
||||
'_getFootersOptions',
|
||||
array('row')
|
||||
@ -227,19 +236,22 @@ class QbeTest extends PmaTestCase
|
||||
*/
|
||||
public function testGetTableFooters()
|
||||
{
|
||||
$this->assertEquals(
|
||||
'<fieldset class="tblFooters"><div class="floatleft">Add/Delete criteria'
|
||||
. ' rows:<select size="1" name="criteriaRowAdd"><option value="-3">-3'
|
||||
. '</option><option value="-2">-2</option><option value="-1">-1</option>'
|
||||
. '<option value="0" selected="selected">0</option><option value="1">1'
|
||||
. '</option><option value="2">2</option><option value="3">3</option>'
|
||||
. '</select></div><div class="floatleft">Add/Delete columns:<select '
|
||||
. 'size="1" name="criteriaColumnAdd"><option value="-3">-3</option>'
|
||||
. '<option value="-2">-2</option><option value="-1">-1</option>'
|
||||
. '<option value="0" selected="selected">0</option><option value="1">1'
|
||||
. '</option><option value="2">2</option><option value="3">3</option>'
|
||||
. '</select></div><div class="floatleft"><input type="submit" '
|
||||
. 'name="modify"value="Update Query" /></div></fieldset>',
|
||||
$this->assertContains(
|
||||
'name="criteriaRowAdd"',
|
||||
$this->_callProtectedFunction(
|
||||
'_getTableFooters',
|
||||
array()
|
||||
)
|
||||
);
|
||||
$this->assertContains(
|
||||
'name="criteriaColumnAdd"',
|
||||
$this->_callProtectedFunction(
|
||||
'_getTableFooters',
|
||||
array()
|
||||
)
|
||||
);
|
||||
$this->assertContains(
|
||||
'<input type="submit" name="modify" value="Update Query" />',
|
||||
$this->_callProtectedFunction(
|
||||
'_getTableFooters',
|
||||
array()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user