Add direction toggle to the history section

Fixes #509.
This commit is contained in:
Thomas Jost 2016-04-17 23:35:50 +02:00
parent aaaafb263b
commit 6301e46444
2 changed files with 9 additions and 4 deletions

View File

@ -2,6 +2,8 @@
// Display history page // Display history page
Router\get_action('history', function () { Router\get_action('history', function () {
$order = Request\param('order', 'updated');
$direction = Request\param('direction', Model\Config\get('items_sorting_direction'));
$offset = Request\int_param('offset', 0); $offset = Request\int_param('offset', 0);
$group_id = Request\int_param('group_id', null); $group_id = Request\int_param('group_id', null);
$feed_ids = array(); $feed_ids = array();
@ -15,8 +17,8 @@ Router\get_action('history', function () {
$feed_ids, $feed_ids,
$offset, $offset,
Model\Config\get('items_per_page'), Model\Config\get('items_per_page'),
'updated', $order,
Model\Config\get('items_sorting_direction') $direction
); );
$nb_items = Model\Item\count_by_status('read', $feed_ids); $nb_items = Model\Item\count_by_status('read', $feed_ids);
@ -25,8 +27,8 @@ Router\get_action('history', function () {
'favicons' => Model\Favicon\get_item_favicons($items), 'favicons' => Model\Favicon\get_item_favicons($items),
'original_marks_read' => Model\Config\get('original_marks_read'), 'original_marks_read' => Model\Config\get('original_marks_read'),
'items' => $items, 'items' => $items,
'order' => '', 'order' => $order,
'direction' => '', 'direction' => $direction,
'display_mode' => Model\Config\get('items_display_mode'), 'display_mode' => Model\Config\get('items_display_mode'),
'item_title_link' => Model\Config\get('item_title_link'), 'item_title_link' => Model\Config\get('item_title_link'),
'group_id' => $group_id, 'group_id' => $group_id,

View File

@ -17,6 +17,9 @@
<?php endif ?> <?php endif ?>
<ul> <ul>
<li>
<a href="?action=history<?= is_null($group_id) ? '' : '&amp;group_id='.$group_id ?>&amp;order=updated&amp;direction=<?= $direction == 'asc' ? 'desc' : 'asc' ?>"><?= tne('sort by date %s(%s)%s', '<span class="hide-mobile">', $direction == 'desc' ? t('older first') : t('most recent first'), '</span>') ?></a>
</li>
<li><a href="?action=confirm-flush-history<?= is_null($group_id) ? '' : '&amp;group_id='.$group_id ?>"><?= t('flush all items') ?></a></li> <li><a href="?action=confirm-flush-history<?= is_null($group_id) ? '' : '&amp;group_id='.$group_id ?>"><?= t('flush all items') ?></a></li>
</ul> </ul>
</div> </div>