unify redirect/menu/source url parameter

This commit is contained in:
Mathias Kresin 2016-08-05 20:21:40 +02:00
parent b1187f5071
commit 0b4ee5d347
4 changed files with 8 additions and 8 deletions

View File

@ -18,18 +18,18 @@ Router\post_action('bookmark', function () {
// Add new bookmark
Router\get_action('bookmark', function () {
$id = Request\param('id');
$menu = Request\param('menu', 'unread');
$source = Request\param('source', 'unread');
$menu = Request\param('menu');
$redirect = Request\param('redirect', 'unread');
$offset = Request\int_param('offset', 0);
$feed_id = Request\int_param('feed_id', 0);
Model\Item\set_bookmark_value($id, Request\int_param('value'));
if ($source === 'show') {
if ($redirect === 'show') {
Response\redirect('?action=show&menu='.$menu.'&id='.$id);
}
Response\redirect('?action='.$menu.'&offset='.$offset.'&feed_id='.$feed_id.'#item-'.$id);
Response\redirect('?action='.$redirect.'&offset='.$offset.'&feed_id='.$feed_id.'#item-'.$id);
});
// Display bookmarks page

View File

@ -2,14 +2,14 @@
<?php if ($item['bookmark']): ?>
<a
class="bookmark"
href="?action=bookmark&amp;value=0&amp;id=<?= $item['id'] ?>&amp;offset=<?= $offset ?>&amp;menu=<?= $menu ?>&amp;feed_id=<?= $item['feed_id'] ?>"
href="?action=bookmark&amp;value=0&amp;id=<?= $item['id'] ?>&amp;offset=<?= $offset ?>&amp;redirect=<?= $menu ?>&amp;feed_id=<?= $item['feed_id'] ?>"
data-action="bookmark"
data-reverse-label="<?= t('bookmark') ?>"
><?= t('remove bookmark') ?></a>
<?php else: ?>
<a
class="bookmark"
href="?action=bookmark&amp;value=1&amp;id=<?= $item['id'] ?>&amp;offset=<?= $offset ?>&amp;menu=<?= $menu ?>&amp;feed_id=<?= $item['feed_id'] ?>"
href="?action=bookmark&amp;value=1&amp;id=<?= $item['id'] ?>&amp;offset=<?= $offset ?>&amp;redirect=<?= $menu ?>&amp;feed_id=<?= $item['feed_id'] ?>"
data-action="bookmark"
data-reverse-label="<?= t('remove bookmark') ?>"
><?= t('bookmark') ?></a>

View File

@ -10,7 +10,7 @@
<span class="item-icons">
<a
class="bookmark-icon"
href="?action=bookmark&amp;value=<?= (int)!$item['bookmark'] ?>&amp;id=<?= $item['id'] ?>&amp;offset=<?= $offset ?>&amp;menu=<?= $menu ?>&amp;feed_id=<?= $item['feed_id'] ?>"
href="?action=bookmark&amp;value=<?= (int)!$item['bookmark'] ?>&amp;id=<?= $item['id'] ?>&amp;offset=<?= $offset ?>&amp;redirect=<?= $menu ?>&amp;feed_id=<?= $item['feed_id'] ?>"
title="<?= ($item['bookmark']) ? t('remove bookmark') : t('bookmark') ?>"
data-action="bookmark"
data-reverse-title="<?= ($item['bookmark']) ? t('bookmark') : t('remove bookmark') ?>"

View File

@ -37,7 +37,7 @@
<li>
<a
class="bookmark-icon"
href="?action=bookmark&amp;value=<?= (int)!$item['bookmark'] ?>&amp;id=<?= $item['id'] ?>&amp;source=show&amp;menu=<?= $menu ?>"
href="?action=bookmark&amp;value=<?= (int)!$item['bookmark'] ?>&amp;id=<?= $item['id'] ?>&amp;redirect=show&amp;menu=<?= $menu ?>"
title="<?= ($item['bookmark']) ? t('remove bookmark') : t('bookmark') ?>"
data-reverse-title="<?= ($item['bookmark']) ? t('bookmark') :t('remove bookmark') ?>"
data-action="bookmark"