Mass tag: friendler pagination
If user is in mass tag mode and changes target tag but doesn't change the query, he now remains at the same page. (Concerns only users who have disabled endless scrolling.)
This commit is contained in:
parent
f783552820
commit
9eee8ba612
2 changed files with 13 additions and 5 deletions
|
@ -103,13 +103,19 @@ class TagController
|
||||||
PrivilegesHelper::confirmWithException(Privilege::MassTag);
|
PrivilegesHelper::confirmWithException(Privilege::MassTag);
|
||||||
if (InputHelper::get('submit'))
|
if (InputHelper::get('submit'))
|
||||||
{
|
{
|
||||||
|
$suppliedOldPage = intval(InputHelper::get('old-page'));
|
||||||
|
$suppliedOldQuery = InputHelper::get('old-query');
|
||||||
$suppliedQuery = InputHelper::get('query');
|
$suppliedQuery = InputHelper::get('query');
|
||||||
if (!$suppliedQuery)
|
|
||||||
$suppliedQuery = ' ';
|
|
||||||
$suppliedTag = InputHelper::get('tag');
|
$suppliedTag = InputHelper::get('tag');
|
||||||
if (!empty($suppliedTag))
|
|
||||||
$suppliedTag = TagModel::validateTag($suppliedTag);
|
$params = [
|
||||||
\Chibi\UrlHelper::forward(\Chibi\UrlHelper::route('post', 'list', ['source' => 'mass-tag', 'query' => $suppliedQuery, 'additionalInfo' => $suppliedTag]));
|
'source' => 'mass-tag',
|
||||||
|
'query' => $suppliedQuery ?: ' ',
|
||||||
|
'additionalInfo' => $suppliedTag ? TagModel::validateTag($suppliedTag) : '',
|
||||||
|
];
|
||||||
|
if ($suppliedOldPage != 0 and $suppliedOldQuery == $suppliedQuery)
|
||||||
|
$params['page'] = $suppliedOldPage;
|
||||||
|
\Chibi\UrlHelper::forward(\Chibi\UrlHelper::route('post', 'list', $params));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
<div class="input-wrapper"><input class="autocomplete" type="text" name="tag" id="mass-tag-tag" value="<?php echo isset($this->context->massTagTag) ? htmlspecialchars($this->context->massTagTag) : '' ?>"/></div>
|
<div class="input-wrapper"><input class="autocomplete" type="text" name="tag" id="mass-tag-tag" value="<?php echo isset($this->context->massTagTag) ? htmlspecialchars($this->context->massTagTag) : '' ?>"/></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<input type="hidden" name="old-page" value="<?php echo isset($this->context->transport->paginator) ? htmlspecialchars($this->context->transport->paginator->page) : '' ?>"/>
|
||||||
|
<input type="hidden" name="old-query" value="<?php echo isset($this->context->massTagQuery) ? htmlspecialchars($this->context->massTagQuery) : '' ?>"/>
|
||||||
<input type="hidden" name="submit" value="1"/>
|
<input type="hidden" name="submit" value="1"/>
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
|
|
Reference in a new issue