Alpha 6: Feed-level Pages (#21)

Reviewed-on: #21
This commit was merged in pull request #21.
This commit is contained in:
2024-05-23 23:04:41 +00:00
parent 93377ffa0e
commit 4fa4dcb831
14 changed files with 256 additions and 85 deletions

View File

@@ -27,9 +27,11 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$keepUnread->execute();
}
$db->close();
frc_redirect('/');
frc_redirect($_POST['from']);
}
$from = $_GET['from'] ?? '/';
if ($_SERVER['REQUEST_METHOD'] == 'DELETE') {
$deleteQuery = $db->prepare(<<<'SQL'
DELETE FROM item
@@ -47,7 +49,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'DELETE') {
add_error(Data::error($db)['error']);
}
$db->close();
frc_redirect('/');
frc_redirect($from);
}
$query = $db->prepare(<<<'SQL'
@@ -83,7 +85,8 @@ page_head(htmlentities("{$item['item_title']} | {$item['feed_title']}")); ?>
<div class=item_content><?=str_replace('<a ', '<a target=_blank rel=noopener ', $item['content'])?></div>
<form class=action_buttons action=/item method=POST hx-post=/item>
<input type=hidden name=id value=<?=$_GET['id']?>>
<a href=/ hx-get="/">Done</a>
<input type=hidden name=from value="<?=$from?>">
<?=hx_get($from, 'Done')?>
<button type=submit>Keep as New</button>
<button type=button hx-delete=/item>Delete</button>
</form>