WIP on add/edit feed page (#4)

Mostly style tweaks
This commit is contained in:
Daniel J. Summers 2024-04-08 07:31:32 -04:00
parent 7d30454d90
commit c89e6af346
3 changed files with 39 additions and 14 deletions

View File

@ -5,11 +5,12 @@ html {
body { body {
margin: 0; margin: 0;
font-size: 1rem; font-size: 1rem;
background-color: #eeeeee; background: linear-gradient(135deg, #eeeeff, #ddddff, #eeeeff, #ccccff);
/* background-color: #eeeeee; */
} }
header { header {
padding: 0 1rem .5rem 1rem; padding: 0 1rem .5rem 1rem;
background: linear-gradient(#000064, #000048, #000032); background: linear-gradient(#000032, #000048, #000064);
border-bottom-left-radius: .5rem; border-bottom-left-radius: .5rem;
border-bottom-right-radius: .5rem; border-bottom-right-radius: .5rem;
color: white; color: white;
@ -33,3 +34,21 @@ header {
main { main {
padding: 0 .5rem; padding: 0 .5rem;
} }
article {
max-width: 60rem;
margin: auto;
}
input[type=url], input[type=text] {
width: 50%;
font-size: 1rem;
padding: .25rem;
border-radius: .25rem;
}
button {
font-size: 1rem;
background-color: navy;
color: white;
padding: .25rem 1rem;
border-radius: .25rem;
cursor: pointer;
}

View File

@ -8,23 +8,29 @@
include '../start.php'; include '../start.php';
Security::verifyUser(); Security::verifyUser();
page_head('Feed page');
if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// TODO: get feed, add if new, reject if existing but not owned by this user, update otherwise // TODO: get feed, add if new, reject if existing but not owned by this user, update otherwise
$feed = array(); $feed = [ 'id' => $_POST['id'], 'url' => $_POST['url'] ];
$title = 'TODO';
} else { } else {
// TODO: Retrieve feed by ID if not new // TODO: Retrieve feed by ID if not new
$feed = [ 'id' => $_GET['id'], 'url' => '' ]; $feed = [ 'id' => $_GET['id'], 'url' => '' ];
$title = 'Add RSS Feed';
} }
page_head($title);
?> ?>
<h1>Add/Edit Feed</h1> <h1><?=$title?></h1>
<form method=POST action=/feed hx-post=/feed> <article>
<input type=hidden name=id value="<?=$feed['id']?>"> <form method=POST action=/feed hx-post=/feed>
<label> <input type=hidden name=id value=<?=$feed['id']?>>
Feed URL <label>
<input type=url name=url required autofocus value="<?=$feed['url']?>"> Feed URL
</label> <input type=url name=url required autofocus value="<?=$feed['url']?>">
</form> </label><br>
<button type=submit>Save</button>
</form>
</article>
<?php <?php
page_foot(); page_foot();

View File

@ -18,14 +18,14 @@ Data::ensureDb();
*/ */
function page_head(string $title): void { function page_head(string $title): void {
?><!DOCTYPE html> ?><!DOCTYPE html>
<html lang="en"> <html lang=en>
<head> <head>
<title><?=$title?> | Feed Reader Central</title> <title><?=$title?> | Feed Reader Central</title>
<link href=/assets/style.css rel=stylesheet> <link href=/assets/style.css rel=stylesheet>
</head> </head>
<body> <body>
<header> <header>
<div class=title>Feed Reader Central</div> <a class=title href="/">Feed Reader Central</a>
<div><?php <div><?php
if (array_key_exists('FRC_USER_ID', $_REQUEST)) { if (array_key_exists('FRC_USER_ID', $_REQUEST)) {
echo '<a href=/feed?id=new>Add Feed</a>'; echo '<a href=/feed?id=new>Add Feed</a>';