forked from Public/pics
TabularData: take control of juxtapositing pager and form
This commit is contained in:
parent
77fa33730a
commit
2af4e865e0
@ -18,8 +18,7 @@ class ManageAlbums extends HTMLController
|
||||
'form' => [
|
||||
'action' => BASEURL . '/editalbum/',
|
||||
'method' => 'get',
|
||||
'class' => 'col-md-6 text-end',
|
||||
'buttons' => [
|
||||
'controls' => [
|
||||
'add' => [
|
||||
'type' => 'submit',
|
||||
'caption' => 'Add new album',
|
||||
@ -58,7 +57,6 @@ class ManageAlbums extends HTMLController
|
||||
'title' => 'Manage albums',
|
||||
'no_items_label' => 'No albums meet the requirements of the current filter.',
|
||||
'items_per_page' => 9999,
|
||||
'index_class' => 'col-md-6',
|
||||
'base_url' => BASEURL . '/managealbums/',
|
||||
'get_data' => function($offset, $limit, $order, $direction) {
|
||||
return Tag::getOffset($offset, $limit, $order, $direction, true);
|
||||
|
@ -23,7 +23,6 @@ class ManageAssets extends HTMLController
|
||||
'form' => [
|
||||
'action' => BASEURL . '/manageassets/?' . Session::getSessionTokenKey() . '=' . Session::getSessionToken(),
|
||||
'method' => 'post',
|
||||
'class' => 'col-md-6 text-end',
|
||||
'is_embed' => true,
|
||||
'controls' => [
|
||||
'deleteChecked' => [
|
||||
@ -113,7 +112,6 @@ class ManageAssets extends HTMLController
|
||||
'title' => 'Manage assets',
|
||||
'no_items_label' => 'No assets meet the requirements of the current filter.',
|
||||
'items_per_page' => 30,
|
||||
'index_class' => 'col-md-6',
|
||||
'base_url' => BASEURL . '/manageassets/',
|
||||
'get_data' => 'Asset::getOffset',
|
||||
'get_count' => 'Asset::getCount',
|
||||
|
@ -29,7 +29,6 @@ class ManageErrors extends HTMLController
|
||||
'form' => [
|
||||
'action' => BASEURL . '/manageerrors/?' . Session::getSessionTokenKey() . '=' . Session::getSessionToken(),
|
||||
'method' => 'post',
|
||||
'class' => 'col-md-6 text-end',
|
||||
'controls' => [
|
||||
'clear' => [
|
||||
'type' => 'submit',
|
||||
@ -95,7 +94,6 @@ class ManageErrors extends HTMLController
|
||||
'sort_direction' => $_GET['dir'] ?? '',
|
||||
'no_items_label' => "No errors to display -- we're all good!",
|
||||
'items_per_page' => 20,
|
||||
'index_class' => 'col-md-6',
|
||||
'base_url' => BASEURL . '/manageerrors/',
|
||||
'get_count' => 'ErrorLog::getCount',
|
||||
'get_data' => 'ErrorLog::getOffset',
|
||||
|
@ -20,7 +20,6 @@ class ManageTags extends HTMLController
|
||||
'form' => [
|
||||
'action' => BASEURL . '/edittag/',
|
||||
'method' => 'get',
|
||||
'class' => 'col-md-6 text-end',
|
||||
'controls' => [
|
||||
'add' => [
|
||||
'type' => 'submit',
|
||||
@ -70,8 +69,7 @@ class ManageTags extends HTMLController
|
||||
'sort_direction' => $_GET['dir'] ?? '',
|
||||
'title' => 'Manage tags',
|
||||
'no_items_label' => 'No tags meet the requirements of the current filter.',
|
||||
'items_per_page' => 30,
|
||||
'index_class' => 'col-md-6',
|
||||
'items_per_page' => 9999,
|
||||
'base_url' => BASEURL . '/managetags/',
|
||||
'get_data' => function($offset, $limit, $order, $direction) {
|
||||
return Tag::getOffset($offset, $limit, $order, $direction, false);
|
||||
|
@ -20,7 +20,6 @@ class ManageUsers extends HTMLController
|
||||
'form' => [
|
||||
'action' => BASEURL . '/edituser/',
|
||||
'method' => 'get',
|
||||
'class' => 'col-md-6 text-end',
|
||||
'controls' => [
|
||||
'add' => [
|
||||
'type' => 'submit',
|
||||
@ -86,7 +85,6 @@ class ManageUsers extends HTMLController
|
||||
'title' => 'Manage users',
|
||||
'no_items_label' => 'No users meet the requirements of the current filter.',
|
||||
'items_per_page' => 30,
|
||||
'index_class' => 'col-md-6',
|
||||
'base_url' => BASEURL . '/manageusers/',
|
||||
'get_data' => 'Member::getOffset',
|
||||
'get_count' => 'Member::getCount',
|
||||
|
@ -12,10 +12,10 @@ class InlineFormView
|
||||
{
|
||||
if (!isset($form['is_embed']))
|
||||
echo '
|
||||
<form action="', $form['action'], '" method="', $form['method'], '" class="', $form['class'], '">';
|
||||
<form action="', $form['action'], '" method="', $form['method'], '" class="', $form['class'] ?? '', '">';
|
||||
else
|
||||
echo '
|
||||
<div class="', $form['class'], '">';
|
||||
<div class="', $form['class'] ?? '', '">';
|
||||
|
||||
if (!empty($form['is_group']))
|
||||
echo '
|
||||
|
@ -68,23 +68,39 @@ class TabularData extends SubTemplate
|
||||
}
|
||||
}
|
||||
|
||||
protected function renderPaginationForm($pager, $form, $class='row')
|
||||
protected function renderPaginationForm($pager, $form)
|
||||
{
|
||||
echo '
|
||||
<div class="', $class, ' clearfix justify-content-end">';
|
||||
<div class="row clearfix justify-content-end">';
|
||||
|
||||
// Page index?
|
||||
if (!empty($pager))
|
||||
{
|
||||
echo '
|
||||
<div class="col-md">';
|
||||
|
||||
PageIndexWidget::paginate($pager);
|
||||
|
||||
echo '
|
||||
</div>';
|
||||
}
|
||||
|
||||
// Form controls?
|
||||
if (isset($form))
|
||||
{
|
||||
echo '
|
||||
<div class="col-md-auto">';
|
||||
|
||||
InlineFormView::renderInlineForm($form);
|
||||
|
||||
echo '
|
||||
</div>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</div>';
|
||||
}
|
||||
|
||||
protected function renderTableHead(array $headers)
|
||||
{
|
||||
echo '
|
||||
|
Loading…
x
Reference in New Issue
Block a user