mirror of
https://github.com/aykhans/portfolio-blog.git
synced 2025-09-10 08:00:44 +00:00
Added create and update post pages
This commit is contained in:
57
src/app/templates/admin/add-post.html
Normal file
57
src/app/templates/admin/add-post.html
Normal file
@@ -0,0 +1,57 @@
|
||||
<!DOCTYPE html>
|
||||
<html data-bs-theme="light" lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
||||
<title>Add Post</title>
|
||||
<link rel="icon" type="image/png" href="/static/img/shipit.png">
|
||||
<link rel="stylesheet" href="/static/bootstrap/css/bootstrap.min.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<style>
|
||||
/* CKEditor */
|
||||
#container {
|
||||
width: 1000px;
|
||||
margin: 20px auto;
|
||||
}
|
||||
.ck-editor__editable[role="textbox"] {
|
||||
/* editing area */
|
||||
min-height: 500px;
|
||||
}
|
||||
.ck-content .image {
|
||||
/* block images */
|
||||
max-width: 80%;
|
||||
margin: 20px auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="container" style="margin-top: 4rem;">
|
||||
<div class="row">
|
||||
<div class="col-md-10 col-lg-6 mx-auto">
|
||||
<form action="/add-post" method="POST" enctype="multipart/form-data">
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="title" id="title" placeholder="Enter title">
|
||||
</div>
|
||||
<div class="form-group" style="margin-top: 3rem; margin-bottom: 3rem;">
|
||||
<textarea name="text" required></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="post-image">Image</label>
|
||||
<input type="file" class="form-control-file" name="image" id="post-image">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary" style="margin-top: 3rem; margin-bottom: 5rem;">Save</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.ckeditor.com/4.22.1/standard/ckeditor.js"></script>
|
||||
<script src="/static/bootstrap/js/bootstrap.min.js"></script>
|
||||
<script>
|
||||
CKEDITOR.replace('text');
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@@ -5,8 +5,8 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
||||
<title>Login</title>
|
||||
<link rel="icon" type="image/png" href="static/img/shipit.png">
|
||||
<link rel="stylesheet" href="static/bootstrap/css/bootstrap.min.css">
|
||||
<link rel="icon" type="image/png" href="/static/img/shipit.png">
|
||||
<link rel="stylesheet" href="/static/bootstrap/css/bootstrap.min.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -31,7 +31,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="static/bootstrap/js/bootstrap.min.js"></script>
|
||||
<script src="/static/bootstrap/js/bootstrap.min.js"></script>
|
||||
<script>
|
||||
function handleSubmit(event) {
|
||||
event.preventDefault();
|
||||
@@ -60,6 +60,7 @@
|
||||
var now = new Date();
|
||||
now.setDate(now.getDate() + 30);
|
||||
document.cookie = `access_token=${accessToken};expires=${now.toUTCString()};path=/`;
|
||||
window.location.href = window.location.origin;
|
||||
})
|
||||
.catch(error => {
|
||||
document.getElementById('responseError').innerHTML = error.message;
|
||||
|
66
src/app/templates/admin/update-post.html
Normal file
66
src/app/templates/admin/update-post.html
Normal file
@@ -0,0 +1,66 @@
|
||||
<!DOCTYPE html>
|
||||
<html data-bs-theme="light" lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
||||
<title>Update Post</title>
|
||||
<link rel="icon" type="image/png" href="/static/img/shipit.png">
|
||||
<link rel="stylesheet" href="/static/bootstrap/css/bootstrap.min.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<style>
|
||||
/* CKEditor */
|
||||
#container {
|
||||
width: 1000px;
|
||||
margin: 20px auto;
|
||||
}
|
||||
.ck-editor__editable[role="textbox"] {
|
||||
/* editing area */
|
||||
min-height: 500px;
|
||||
}
|
||||
.ck-content .image {
|
||||
/* block images */
|
||||
max-width: 80%;
|
||||
margin: 20px auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="container" style="margin-top: 4rem;">
|
||||
<div class="row">
|
||||
<div class="col-md-10 col-lg-6 mx-auto">
|
||||
<form action="/update-post/{{post.slug}}" method="POST" enctype="multipart/form-data" style="margin-bottom: 4.5rem;">
|
||||
<div class="form-group" style="margin-bottom: 1.5rem;">
|
||||
<input value="{{post.title}}" type="text" class="form-control" name="title" id="title" placeholder="Enter title" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
</form>
|
||||
<form action="/update-post/{{post.slug}}" method="POST" enctype="multipart/form-data" style="margin-bottom: 4.5rem;">
|
||||
<div class="form-group" style="margin-bottom: 1.5rem;">
|
||||
<textarea name="text" required>
|
||||
{{post.text}}
|
||||
</textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
</form>
|
||||
<form action="/update-post/{{post.slug}}" method="POST" enctype="multipart/form-data" style="margin-bottom: 4.5rem;">
|
||||
<p style="font-size: medium;">Current: <a href="/{{post.image_url}}" target=”_blank”>{{post.image_url}}</a></p>
|
||||
<div class="form-group" style="margin-bottom: 1.5rem;">
|
||||
<label for="post-image">Image</label>
|
||||
<input type="file" class="form-control-file" name="image" id="post-image">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.ckeditor.com/4.22.1/standard/ckeditor.js"></script>
|
||||
<script src="/static/bootstrap/js/bootstrap.min.js"></script>
|
||||
<script>
|
||||
CKEDITOR.replace('text');
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@@ -5,15 +5,15 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
||||
<title>{% block title %}{% endblock title %}</title>
|
||||
<link rel="icon" type="image/png" href="static/img/shipit.png">
|
||||
<link rel="stylesheet" href="static/bootstrap/css/bootstrap.min.css">
|
||||
<link rel="icon" type="image/png" href="/static/img/shipit.png">
|
||||
<link rel="stylesheet" href="/static/bootstrap/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800&display=swap">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic&display=swap">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Abril+Fatface&display=swap">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Aclonica&display=swap">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Alatsi&display=swap">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Alfa+Slab+One&display=swap">
|
||||
<link rel="stylesheet" href="static/fonts/font-awesome.min.css">
|
||||
<link rel="stylesheet" href="/static/fonts/font-awesome.min.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -48,8 +48,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="static/bootstrap/js/bootstrap.min.js"></script>
|
||||
<script src="static/js/clean-blog.js"></script>
|
||||
<script src="/static/bootstrap/js/bootstrap.min.js"></script>
|
||||
<script src="/static/js/clean-blog.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
@@ -34,7 +34,7 @@
|
||||
</figure>
|
||||
<p>Spaceflights cannot be stopped. This is not the work of any one man or even a group of men. It is a historical process which mankind is carrying out in accordance with the natural laws of human development.</p>
|
||||
<h2 class="section-heading">Reaching for the Stars</h2>
|
||||
<p>As we got further and further away, it [the Earth] diminished in size. Finally it shrank to the size of a marble, the most beautiful you can imagine. That beautiful, warm, living object looked so fragile, so delicate, that if you touched it with a finger it would crumble and fall apart. Seeing this has to change a man.</p><a href="#"><img class="img-fluid" src="static/img/post-sample-image.jpg"></a><span class="text-muted caption">To go places and do things that have never been done before – that’s what living is all about.</span>
|
||||
<p>As we got further and further away, it [the Earth] diminished in size. Finally it shrank to the size of a marble, the most beautiful you can imagine. That beautiful, warm, living object looked so fragile, so delicate, that if you touched it with a finger it would crumble and fall apart. Seeing this has to change a man.</p><a href="#"><img class="img-fluid" src="/static/img/post-sample-image.jpg"></a><span class="text-muted caption">To go places and do things that have never been done before – that’s what living is all about.</span>
|
||||
<p>Space, the final frontier. These are the voyages of the Starship Enterprise. Its five-year mission: to explore strange new worlds, to seek out new life and new civilizations, to boldly go where no man has gone before.</p>
|
||||
<p>As I stand out here in the wonders of the unknown at Hadley, I sort of realize there’s a fundamental truth to our nature, Man must explore, and this is exploration at its greatest.</p>
|
||||
<p><span>Placeholder text by </span><a href="http://spaceipsum.com">Space Ipsum</a><span> Photographs by </span><a href="https://www.flickr.com/photos/nasacommons/">NASA on The Commons</a>.</p>
|
||||
|
Reference in New Issue
Block a user